Difference between revisions of "How to edit the JReviews language files"
Line 6: | Line 6: | ||
*<span style="color: blue">/components/com_jreviews_addons/addon-name/locale/</span> | *<span style="color: blue">/components/com_jreviews_addons/addon-name/locale/</span> | ||
− | There's a folder for each language. | + | There's a folder for each language. To modify the language files use the JReviews overrides folder so you don't lose your changes when you upgrade. If you haven't already created the overrides folder, you should create it under the Joomla templates folder: |
+ | |||
+ | *<span style="color: blue">/templates/jreviews_overrides/</span> | ||
+ | |||
+ | Then if you want to make changes to the Spanish language default.po file, you create an '''empty''' default.po file in: | ||
+ | |||
+ | *<span style="color: blue">/templates/jreviews_overrides/locale/spa/LC_MESSAES/default.po</span> | ||
+ | |||
+ | And proceed to add only the language strings you want to modify. | ||
When translating or changing the .po file it is very important to keep the character encoding of the file. In order to do this you need to use a special editor like Notepad++ or Poedit. Both are free applications. '''The files must be saved with UTF-8 encoding.''' | When translating or changing the .po file it is very important to keep the character encoding of the file. In order to do this you need to use a special editor like Notepad++ or Poedit. Both are free applications. '''The files must be saved with UTF-8 encoding.''' | ||
Line 13: | Line 21: | ||
<source lang="php"> | <source lang="php"> | ||
− | |||
− | |||
msgid "Submit" | msgid "Submit" | ||
msgstr "Submit" | msgstr "Submit" | ||
Line 23: | Line 29: | ||
<source lang="php"> | <source lang="php"> | ||
− | |||
− | |||
msgid "Submit" | msgid "Submit" | ||
msgstr "Enviar" | msgstr "Enviar" |
Revision as of 00:00, 20 February 2014
JReviews uses language files for all the text that is used in the themes. To change the text or translate it to a different language you need to edit the files in:
- /components/com_jreviews/jreviews/locale/
For add-ons you can find the language folders in:
- /components/com_jreviews_addons/addon-name/locale/
There's a folder for each language. To modify the language files use the JReviews overrides folder so you don't lose your changes when you upgrade. If you haven't already created the overrides folder, you should create it under the Joomla templates folder:
- /templates/jreviews_overrides/
Then if you want to make changes to the Spanish language default.po file, you create an empty default.po file in:
- /templates/jreviews_overrides/locale/spa/LC_MESSAES/default.po
And proceed to add only the language strings you want to modify.
When translating or changing the .po file it is very important to keep the character encoding of the file. In order to do this you need to use a special editor like Notepad++ or Poedit. Both are free applications. The files must be saved with UTF-8 encoding.
When changing the file it is only necessary to change the msgstr, changing the msgid will not work. For example:
msgid "Submit" msgstr "Submit"
Would be changed like this for a Spanish translation:
msgid "Submit" msgstr "Enviar"
The msgid serves as the lookup reference from the .thtml theme files, where you'll find it in this format:
__t("Submit");
There is no need to change the theme .thtml files for translation, but if you do change the references in the __t("text"); format, then those will not be translatable via the language file unless you add to them new reference:
msgid "text"
msgstr "translated text"
After making changes to a language file you must clear the cache in JReviews using the "Clear Cache & File Registry" link in the JReviews administration.
You need to do this even if caching is disabled in JReviews.
It is recommended to use the JReviews Code Overrides functionality to make modifications to language files outside the /com_jreviews folder so that your changes are not lost after you upgrade JReviews.
For example, if you want to customize the spanish language, copy the spanish language folder:
- /components/com_jreviews/jreviews/locale/spa/
into the jreviews_overrides folder like this:
- /templates/jreviews_overrides/locale/spa/