How to edit the JReviews language files
Translating JReviews core language files
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:
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:
Then if you want to make changes to the Spanish language default.po file, you create an empty default.po file in:
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:
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:
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:
into the jreviews_overrides folder like this:
The language file in overrides doesn't need to contain all translations, you can delete everything from the file except the translations that you want to modify.
Every JReviews add-on also has a language file. If you want to customize those translations as well, you can do it inside the same language file where you have JReviews translations.
Translating JReviews Add-on language files
For add-ons you can find the language folders in:
You will use the same language file override for both JReviews core and Add-ons. So if you want to override an Add-ons language strings, first you create the language override file as explained above, and then add only the Add-on strings you want to override to this file.
If your language overrides are not working there are two things you can check:
- Clear the file registry in the JReviews administration to ensure that your new language override file and strings are read and processed.
- Make sure you are using the correct msgid in your language string overrides. To do this, open the original language file, either in your language or the English file if the translation is missing in your language, and lookup the string you see in the JReviews front-end. Sometimes constants are used for the msgid instead of natural language, so this step is important.