jigniter™

jQuery & CodeIgniter – Perfect combination for web application

Archive for the ‘translation’ tag

A straightforward way to translate your language files in CodeIgniter

without comments

Months ago we discussed about different alternatives to add i18n support to CodeIgniter applications. On this opportunity we will show how easy is to maintain your language files using CodeIgniter Language File Translator by MrKirkland and Owen Christian.

Basically what you need to do is download the zip here and then unpack the files under appropriate location, as explained in the article.

Afterward, create your desired language files languages folder. For example, if you would like to use English and Spanish, let’s say you create these two files:

  • application/languages/spanish/general_lang.php
  • application/languages/english/general_lang.php

You’d need to load that general language file in your controller or the autoload.php config file, and then choose which of these files you will use as Master file. That means the file that you will keep updated every time and use as reference when synchronizing with the other slaves files.

Then, you’ll need to run the new controller that was unpacked by pointing your browser to index.php/translator

You will be guided through the translator interface that will take care of your language strings under master and slave files. So, go to your slave files and translate each value.

In case any key in your slave file is not present under your master file, then you will see a mismatch error message warning about that behavior.

For non-english speakers: If you plan to use a different Master file rather than English, you can. In theory you’d need to edit the config file under /application/config/translator.php , but my last attempt did not work in version 0.5.1, For example, if I’d like to use Spanish as Master language instead of English, then I needed to edit the variable used in controllers/translator.php under line #87:


var $masterLang = 'spanish';

For more information, we strongly recommend to read the author’s article.

Written byadmin

January 12th, 2010 at 7:22 pm

CodeIgniter in Spanish Language

without comments

CodeIgniter has been translated to many international languages, not only the User Guide but also the messages and errors strings in its language packs.

For example, you can find Spanish translations for your CodeIgniter applications, here. [Make sure to download the right version, ie: 1.7.2]

The next step once you unpack the .zip is to copy the files into your language directory that usually is located under /system/languages so it will read /system/languages/spanish

Then, to use Spanish messages in your applications you’ll need to chaneg the default language setting in /application/config/config.php under line $config['language']

Written byadmin

January 11th, 2010 at 1:14 pm

Posted inSnippets Ideas

Tagged with , ,