News Joomla Components arrow Tutorials arrow Development tips and tricks arrow Joomla 1.5 auto creation of Language file
Joomla 1.5 auto creation of Language file PDF Print E-mail
Written by Sergey Romanov   
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 (3)Add Comment
...
written by love, July 24, 2007
smilies/smiley.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/smiley.gif smilies/smiley.gif smilies/smiley.gif
nice code.
written by love, July 24, 2007
Hello its very nice code...sample
dd
written by dd, August 30, 2007
ddfggggggggggggggggggggggggg

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

busy
Last Updated ( Friday, 16 March 2007 )
 
< Prev   Next >