Components
| JPromoter |
| JContentSubscription |
| JDefender |
| JUser |
Tutorials
Development tips and tricks
Joomla 1.5 auto creation of Language file
| Joomla 1.5 auto creation of Language file |
| Thursday, 18 January 2007 | |
|
It is not very pleasant either keep entering new items in language file or later look through all the code and compile it to lang file. That is nice system to store languages in UTF8 in en-GB.com_mycomponent.ini file. I think that is smart enough and can make Joomla internalization simple. So as I am quite lazy so I thought of way of automatic language file creation. First thing you will need to do is create your own text class. And it is actually the best development practice. Let's say
Place it before you ever use JText::_(‘str'). Then do butch replace and replace all ‘JText::_(‘ to 'myText::_(' in all php files of your project. Also after that use only this class to display the text. Now everything should work the same way. The only thing is that you now can process any text before it is displayed. I think that most of you already guessed what else is needed to be done. But I have still one suggestion. Do not process text exactly to en-GB.com_mycomponent.ini. Save it to lang.txt and later revise it and update en-GB.com_mycomponent.ini. Here is the full code I use for that but you can develop better code. And if you do please, send it to me and I'll update it here.
Comments (6)
![]() Write comment
|
|
| Last Updated ( Friday, 16 March 2007 ) |
| < Prev | Next > |
|---|


