How to edit the JReviews language files

From JReviews Documentation
Revision as of 13:35, 10 October 2014 by Jreviews (Talk | contribs)

Jump to: navigation, search
WordPress users: apologies while we get the documentation updated. The paths below are different for WordPress. The JReviews locale folder is in /wp-content/plugins/jreviews/jreviews/locale and overrides go in ROOT/jreviews_overrides.

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_MESSAGES/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.

Cache-fileregistry.png

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/

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.