Languages & Localization

Use JReviews on sites in any language and easily adjust the language strings as needed. There are over 30 user contributed language translations for JReviews at this time, with varying levels of completeness.

The Language System

Like most software, JReviews has static language strings that are used throughout the application for headings, form labels, buttons, instructions, and so on.

JReviews detects the language of your site based on the language chosen in Joomla and WordPress and automatically loads the right language file if one is found, otherwise it will default to English language.

The language strings are stored in language files that can be easily overriden. The override system is incremental, so you can override just the strings you need, instead of having to copy the entire language file and making changes there. This simplifies the maintenance work for the overrides.

There are three different language or locale files:

  1. default.po the majority of strings used in the front-end are here
  2. locale.po localization strings used for currency formatting, days of the week, months, etc.
  3. admin.po find strings used in the administration

Currently the only languages available for the administration are English, Spanish and Russian. The the last two are only partially completed.

Language Overrides

If you need to change any of the language strings to make them better suited for your website, or to add a missing translation in your language, you can use the override functionality.

The language files are stored in the locale folder structure shown below:

Joomla

components/com_jreviews/jreviews/locale/deu/LC_MESSAGES/
components/com_jreviews/jreviews/locale/eng/LC_MESSAGES/
components/com_jreviews/jreviews/locale/fre/LC_MESSAGES/

WordPress

wp-content/plugins/jreviews/jreviews/locale/deu/LC_MESSAGES/
wp-content/plugins/jreviews/jreviews/locale/eng/LC_MESSAGES/
wp-content/plugins/jreviews/jreviews/locale/fre/LC_MESSAGES/

Add-on Language Strings

Add-ons have their own language files. However, when overriding language strings, you use the same file for JReviews and Add-ons, as explained in the next section.

In Joomla you'll find Add-on language files in:

components/com_jreviews_addons/ADDON_NAME/locale/eng/LC_MESSAGES/

While in WordPress you'll find them in:

wp-content/plugins/jreviews_addons/ADDON_NAME/locale/eng/LC_MESSAGES/

Language Override Example

Lets use an example to illustrate how this works. To change the English string User reviews in the front-end of the site to User evaluations, follow these steps:

  1. Open the English default.po file on your server,found in the /eng/LC_MESSAGES directory referenced above. This could be either a JReviews language file or an Add-on language file.

  2. Search for User reviews and you'll find the following strings:

    msgid "LANG_USER_REVIEWS_HEADING"
    msgstr "User reviews"
    

    msgid is the reference to the string, while the msgstr is the string shown on the site that you want to change.

  3. Create a new, empty, default.po file in overrides in the following location:

    Joomla

    templates/jreviews_overrides/locale/eng/LC_MESSAGES/default.po
    

    WordPress

    jreviews_overrides/locale/eng/LC_MESSAGES/default.po
    

    Remember that this override file will be used for both JReviews core and JReviews Add-ons.

  4. Now add the modified string, more suited for your site in the new file. Since the overrides are incremental, you don't need to copy the contents of the entire default.po file. Just the modifications:

    msgid "LANG_USER_REVIEWS_HEADING"
    msgstr "User evaluations"
    

Clear Cache & File Registry
Clear the registry in the JReviews admin CP after creating new files in overrides.

In the above example, the msgid is using a constant as reference. This means that the msgid doesn't match the msgstr. In many cases, both msgid and msgstr match. The reason for the difference is that as time went by, some of the Add-ons started having duplicate language strings used in different pages, and it was necessary to introduce constants to differentiate these strings.

Always use the English file as reference when searching for strings that appear in English on your site. This way, if the msgid is a constant, you are guaranteed to find the right msgid/msgstr pair.

When you are in a non-English language, if you want to change a translated string, that is not in English, to something that's more suited for your site, search for the string in the the language file for your language so you can find the right msgid/msgstr pair.

String Specifiers

In many language strings you'll find the %d and %s specifiers which are automatically replaced with other values.

msgid "%d reviews with %s stars"
msgstr "%d reviews with %s stars"

If you want to change the string to %d evaluations with %s points you would add the following to your language overrides file:

msgid "%d reviews with %s stars"
msgstr "%d evaluations with %s points"

In the last example %d reviews with %s stars would appear on the site as 10 reviews with 2 stars. You need to keep the specifiers in the strings you override.

Listing Type Language Overrides

A number of language strings can be changed directly via settings under the Listing Types Manager → Language tab.

Listing type language overrides
Override language strings by listing type

All of the default values that appear there are constants, but you can change them with plain language. For example, if you are in a Real Estate listing type, you can change LANG_LISTING_EDIT with Edit Property Details. This allows you to change the strings to values that are better suited for each listing type.

Another approach you can use if you want to keep all of your translations in the language file in overrides is to modify the constant in the language tab and then add the new constant in your overrides file.

For example, you can change LANG_LISTING_EDIT to LANG_LISTING_EDIT_PROPERTY in the Listing Type and save it. Then in the language file add the msgid/msgstr pair:

msgid "LANG_LISTING_EDIT_PROPERTY"
msgstr "Edit Property Details"

Clear Cache & File Registry
Clear the registry in the JReviews admin CP after creating new files in overrides.

Multilingual Sites

While you can create sites in any language, JReviews is not multilingual. A true multilingual system requires:

  1. Translation capability for setup data (categories, field groups, fields, field options, listing types, etc.) as well as all dynamic site or user generated content (listings, reviews, comments, etc.).
  2. Automatically filtering content based on the current user's language selection.
  3. Allowing users to search and find content in the current language.

JReviews does't support any of this functionality and for this reason it is also not marketed as multi-lingual system.

Some clients use solutions that rely on Google Translate to allow site visitors to quickly switch the site from one language to another. This provides some multi-lingual functionality, but it won't give users the ability to search in different languages.