ExpressionEngine Language Translation Utility
published on Jul 21st, 2008 // 10 Comments
A method for using the LG Multi Language extension / plugin in combination with the EE translate utility to maintain language files.
LG Multi Language is an easy way to add language translation based on URL segments or subdomain. The LG Multi Language plugin uses languague files to translate pieces of text such as category names, menu titles or page headings.
The language file must be placed in your template_base_path/language folder in your ExpressionEngine installation and use the following naming convention: lang.your-language-abbreviation.php.
This is one of numerous ExpressionEngine Addons from the talented Leevi Graham
BACKGROUND
The plugin/ extension combination works flawlessly and is a welcomed addition to the much talked about ExpressionEngine Multi-language topic
I was thinking though wouldn’t it be great to have an assigned area to administer these translations rather than manually trying to keep a language file updated.
Luckily for us that this area already exists in the ExpressionEngine Admin panel. CP Home › Admin › Utilities › Translation Utility. See docs here

METHOD
Install Leevi’s LG Multi Language extension / plugin as per his instructions here
Take note of your template_base_path/language folder. My template folder is inside in my system folder and is called ‘template_files’. Inside that is the ‘language’ folder with correct permissions that Leevi asked me to create.
So all it takes is a tweak to the file cp/cp.utilities.php. Around line 5253 replace the path with your base template folder path.
Change this
if ( ! is_writeable(PATH.'translations/'))
in my case to this
if ( ! is_writeable(PATH.'template_files/language/'))
Again around 5258 change
$source_dir = PATH_LANG.'english/';
to this
$source_dir = PATH.'template_files/language/';
Around 5299 change
$source_dir = PATH_LANG.'english/';
$dest_dir = PATH.'translations/';
to
$source_dir = PATH.'template_files/language/';
$dest_dir = PATH.'template_files/language/';
Around 5336 change
$r .= $DSP->qdiv('itemWrapper', BR.'<b>'.stripslashes($val).'</b>');
to
$r .= $DSP->qdiv('itemWrapper', BR.'<b>'.stripslashes($key).'</b>');
Around 5382 change
$dest_dir = PATH.'translations/';
to
$dest_dir = PATH.'template_files/language/';
Around 5396 change
$val = str_replace("\"", """, $val);
$val = stripslashes($val);
to
$val = str_replace("\"", """, $val);
$key = str_replace("_", " ", $key);
$val = stripslashes($val);
Create a language file with all the phrases you wish to use and upload it into template_base_path/language folder calling it something like lang.es.php for spanish and give it the correct permissions
<?php
$L = array(
"First name" =>
"",
"Last Name" =>
"",
"Back" =>
"",
"Print this page" =>
"",
''=>''
);
?>
Now when you goto CP Home › Admin › Utilities › Translation Utility you will see the file you just uploaded.

Click on lang.es.php and you are free to translate your language file from the Control Panel

WARNING
This is a core file tweak. If you are unsure if what you are doing please do not attempt this as I can accept no reponsibility for anything that goes wrong. Also take note of your change so next time you update you can make the change again.
SUMMARY
Hopefully this will ignite some discussion around this method. What I have in my wishlist is the ability for the lang file to be generated from weblog custom fields so you could do all your dynamic content translation there also.
10 Comments
Editor says:
Leevi, that would be great if these features were incorporated into your plugin. It was an immediate solution to a problem I had so I thought I would share it. I’m with you on the not modifying of core files.
Robin says:
Please let me know when you do. It will be the best plugin ever!
Dave Hall says:
Excellent plugin! Looking forward to seeing it action.
Mark B says:
Good work but I can’t resist to rise a deeper issue: a need of core modification to get easy administration of EE translations is a sad scenario. Why designers of EE core are not practically acknowledging the fact that the Internet is a multilingual affair?
Chuck says:
I’d be VERY interested in the plugin Leevi, is there any plan or release??
Thanks!
PS – Admin – maybe you should add DATES to the comments, I’m not sure when any of this happened, or if it’s relevant. Just a suggestion.
Flooftabrarty says:
Good day, sun shines! There have been times of troubles when I felt unhappy missing knowledge about opportunities of getting high yields on investments. I was a dump and downright stupid person. I have never thought that there weren’t any need in large initial investment. Nowadays, I’m happy and lucky , I begin take up real income. It gets down to select a correct companion who uses your funds in a right way – that is incorporate it in real deals, parts and divides the profit with me.
You may ask, if there are such firms? I have to tell the truth, YES, there are. Please be informed of one of them:
http://legalmoneynow.info
Ralspossy says:
Good day !. You may , probably curious to know how one can manage to receive high yields . There is no need to invest much at first. You may start to receive yields with as small sum of money as 20-100 dollars.
AimTrust is what you haven`t ever dreamt of such a chance to become rich
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.
It is based in Panama with affiliates around the world.
Do you want to become an affluent person?
That`s your chance That`s what you really need!
I`m happy and lucky, I began to take up income with the help of this company,
and I invite you to do the same. It`s all about how to select a proper partner utilizes your funds in a right way – that`s it!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://bankinfodata.net and lucky you`re! Let`s take our chance together to become rich
Ralspossy says:
Hello !. You re, I guess , perhaps very interested to know how one can make real money . There is no need to invest much at first. You may commense to receive yields with as small sum of money as 20-100 dollars.
AimTrust is what you need
AimTrust incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.
Its head office is in Panama with offices around the world.
Do you want to become a happy investor?
That`s your chance That`s what you wish in the long run!
I feel good, I started to take up income with the help of this company,
and I invite you to do the same. If it gets down to choose a proper partner utilizes your savings in a right way – that`s it!.
I earn US$2,000 per day, and my first deposit was 1 grand only!
It`s easy to join , just click this link http://bankinfodata.net and go! Let`s take our chance together to get rid of nastiness of the life
tiffany co says:
Let`s take our chance together to get rid of nastiness of the life




Leevi Graham says:
Hey John,
An excellent writeup about using the EE language translation utility with LG Multi-Language. I’m not keen on modfiying the core files so how about I add a couple of more options to what started as a simple plugin.
I’m thinking:
1. Which directory to search for the language files
Option 1. is pretty self explanatory, basically you could point the extension to look in the language folder. Actually that’s all.
I’ll have to take a peek into how the language translation utility works but I’m sure it won’t be too hard. Maybe I should just follow your tutorial
Well done.