How can I translate e107 into my own language?
From e107 Wiki
- Check out the UTF-8 language packs or the ISO language packs for your current e107 version to see if there is already a language pack available. If so, you can download it from there.
-
In Admin > Settings > Language you can define the 'Default Site Language'.
Contents |
Translating the core system
- Each e107 core language has its own directory in \e107_languages. When you want to translate the core system, make a copy of the English folder and rename the folder to Yourlanguage. Make sure your language directory begins with a capital letter.
- Rename English.php to Yourlanguage.php
- Pay special attention to your correct language codes:
- setlocale(LC_ALL, 'en');
- define("CORE_LC", 'en');
- define("CORE_LC2", 'gb');
Use a valid code from the complete ISO 639 language codes list.
- In the \e107_languages\Yourlanguage\ folder, start translating Yourlanguage.php, lan_banner_php up until lan_usersettings.php
All codes are setup in the format:
define("CODE_REFERENCE","This text is to be displayed");
Where CODE_REFERENCE stands for the abbreviation used by programmers in the code. The text between quotes is the text that is displayed in the program user interface. This text is to be translated. The semi-colon character (;) is an indicator for the PHP language that it is the end of the line. Do NOT remove it; it will result in a non-working language file!
- Hint: translating the Core language files is a huge job!
- Start translating all files in \e107_languages\Yourlanguage\admin to also have the administrator settings in your language.
Translating plugins
when you run a non-English plugin that hasn't been translated yet, you have to copy the English language files to your own language. Make sure your language file begins with a capital letter.
Example:
Copy English.php in e107_plugins/search_menu/languages to Yourlanguage.php file in the same directory. Translate the definitions in the file, i.e. the word "Search" in:
define("LAN_180", "Yourlanguageword_for_Search");
Be careful with functions as 'Find and Replace' because you do not want to replace the definition. This will lead to situations where the application shows the definition name instead of the desired translation, because the literal called definition name can not be found in the language file anymore.
Hint: If you do want to use 'Find and Replace' functionality, use case the case sensitive option.
Checking the translation
- Check the translation from the admin panel Admin > Language > Tools (available since e107 version 0.7.7) (e107_admin/language.php?tools).
- Select the language that you would like to verify
- Click on the button 'Begin Verify'.
- If errors are displayed; if needed you can use the 'Edit' button to change the particular file straight away!
- Please note that sometimes some strings are empty in English but need to be filled in other languages. See the discussion in this bugtracker thread.
General translation hints
- Lazy admins could use a translation tool e.g. Google translation plugin or Babelfish translation plugin(and there are more similar tools out there like Father Barry language plugin).
- Use \\n in the translation text to add a new line.
- Hint for Windows users: use an UTF-8 PHP editor as your editor (NOT Wordpad or Notepad!). See Translation file editor suggestions.
- Double forward slashes (//) can be used to indicate a remark
- The indication \\1 within the translation quotes text represents the variable to echo the user name.
- Check your language file: Admin > Settings > Language > Tools > Verify/Edit Language Files, Select Yourlanguage and press the button 'Begin Verify'. Use e.g. Translator plugin for e107 or etrans e107 translation help to really check your language file. Read more information about checking translated language files.
- For regular translators: in order to check differences between two language files the open source tool Winmerge (Win32 platforms only) can be very handy.
Troubleshooting translations files
If you are getting blank pages, or if others are, you should check the following in your language pack files:
- Check for Syntax errors in the php code. A missing " or ); will halt everything.
- Make sure that none of your translated files contain a BOM or Byte Order Mark. Otherwise it will not be visible when viewing in Unicode UTF-8 mode). If you see characters like  , they need to be deleted.
Note: Notepad creates a BOM by default when saving as UTF-8, try removing the  with an ASCII php editor.
- Make sure your {Language}.php file has the correct CHARSET and that your browser is detecting it as such. (usually it's View -> Character Encoding, in the browser)
- If you still get a blank page, login as admin and add ?[debug] to the URL.
example: news.php?[debug] OR news.php?[debug]item.41 - you should then be able to see what the php error is.
See also: How can I post my e107 language file?
Translation file editor suggestions
- For Windows users: Notepad++
- For Windows users: PSPad
- For Windows users: BabelPad
- For Windows users: LightPHPedit
- For Windows users: Notepad2
- For Windows users: Scintilla
- For Windows users: Programmer's Notepad

