If you would like to translate your product into another language, then you can do so by modifying the language files. Follow the simple steps below to get started:
- Create a new folder inside the application/language/ folder. Give the folder the name of your language, such as spanish, italian etc. For this example, I will call mine french.
- Copy the 3 files from inside application/language/english/ to the newly created folder that you just made.
- Inside your new language folder you should now have a content_lang.php, error_lang.php and success_lang.php. You can also add the index.html file too.
You are now ready to begin editting these files.
The content_lang.php contains all translations for most of the content pages on the site. The error_lang.php file contains all the error messages that are given to users when they do something wrong. You are free to translate them all or just a few. The main one should be the content_lang.php as those translations are the ones your users will mostly see.
To edit the translations, all you need to do is type the new correct text inside the double quotes. For example, the following is a couple of lines from the content_lang.php file:
$lang['ctn_3'] = "Provide Us Feedback"; $lang['ctn_4'] = "Email Address";
To translate, you just need to modify the text within the double quotes. For example, a french translation would be:
$lang['ctn_3'] = "Fournir nous Commentaires"; $lang['ctn_4'] = "Adresse e-mail";
Save the file when your done. The final step for your translations to take place, you need to edit the application/config/config.php file. Change the following line:
$config['language'] = 'english';
to the name of the folder that you stored your new language files in. In my case, it was french, so I change it to:
$config['language'] = 'french';
Save config.php and you should see your new translations take place.
You may also need to add the System translation files. These files are for generic System errors. We recommend performing the following steps:
You need to create a folder in your Systems language folder for your new language. The folder name needs to be the same name as your new language. In the example below, it's "spanish". Please follow these steps:
- 1) Create a folder inside system/language/ called spanish
- 2) Locate the following folder: system/language/english/
- 3) Copy all the files inside this folder to your newly created folder (system/language/spanish/)
This software also has the option for the user to change the language themselves. The available languages are based on the translations you have done. A user can change the language of the site by clicking the Change Language link in the footer of the site.
You can add as many available languages are you like. You just need to make sure you have created the language files and folders, as outlined in the guide above.
To make a language available for selection, you need to edit the main config file: application/config/config.php. Look for this line:
$config['available_languages'] = array( "english" => array( "display_name" => "English", "rtl_support" => 0 ) );
This is where you need to add your other languages. For example, to add your French language, edit the code so it says:
$config['available_languages'] = array( "english" => array( "display_name" => "English", "rtl_support" => 0 ), "french" => array( "display_name" => "French", "rtl_support" => 0 ) );
Now when the user visits the Change Language page, the option for French will appear in the menu. Remember, make sure the language files (in this case French) have been added too as outlined in the Language Guide above.
RTL-SUPPORT: If you need to enable right-to-left text, for your language you need to change "rtl_support" => 0 to "rtl_support" => 1. This will then set the page to change text to RTL.