Firefox PHP

template_lang module

Posted by alfaguru 
All files from this thread

File Name File Size   Posted by Date  
template_lang1.0.zip 1.1 KB open | download alfaguru 01/04/2007 Read message
template_lang1.1.zip 628 bytes open | download alfaguru 01/05/2007 Read message
template_lang1.2.zip 651 bytes open | download alfaguru 01/29/2007 Read message
template_lang module
January 04, 2007 11:26AM
This is a very simple module that makes it possible to include language files with a template, in exactly the same fashion as with a module, by specifying a lang directory beneath the one for the template and adding an english.php (plus files for any other languages you wish to support).

Why would you want to do this? For example, by this means you can add extra explanatory text to a page and make it internationalizable without having to change the default lang files. Likewise with an author credit in the page footer.

This is such a useful feature that I think it should go in the core, but for now you can use this module to achieve the same end.
Attachments:
open | download - template_lang1.0.zip (1.1 KB)
Re: template_lang module
January 04, 2007 03:33PM
You have walked a strange route here. You have put code for reading the language file below the template directory in the english.php language file for the module. That's not the intended use of the "lang" hook. That is only for allowing for translation of the module itself. It's better to load the template language file from the "common" hook instead.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: template_lang module
January 04, 2007 03:51PM
Ah, yes. I did that because I couldn't see a suitable hook, but looking again at the code with fresh eyes that's the one. Happily it won't take very long to sort it. Version 1.1 tomorrow.

Thanks for looking and correcting my ignorance. It's a great help.
Re: template_lang module
January 04, 2007 04:13PM
Well, if it works it works, doesn't it? I can just tell what the hooks were originally meant for. How they are used is fully an exercise to and up to the imagination of the module writer ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: template_lang module
January 05, 2007 10:26AM
Changed to use the common hook. Apart from making it easier to understand and more logical, this change has the benefit that the module is now a single file.
Attachments:
open | download - template_lang1.1.zip (628 bytes)
Re: template_lang module
January 29, 2007 09:35AM
The previous version didn't work when a different template (one without a language file) was used on the index page to the one for the forum. Errors occurred because the template language file wasn't being loaded before the page was. This bug is now fixed in this version.
Attachments:
open | download - template_lang1.2.zip (651 bytes)
Sorry, only registered users may post in this forum.

Click here to login