Skip to content

Adding new translations or modifying existing ones.

4Command is already available in 22 languages but that large list may not include your very own language. In addition, you may want to change a few or many language strings used by 4Command to better fit your needs.

To that effect, adding new, or overriding existing translations is possible in several ways.

Types of translations

4Command uses 2 types of translations files:

  • Joomla standard *.ini files are used for a few strings, mostly when 4Command is displayed in the Joomla extensions list or similar
  • Our own *.json language strings format, which is better suited for use in pure javacript application such as 4Command and contains anything you see displayed in the 4Command user interface

As overriding 4Command language strings found in *.ini is standard Joomla procedure, we won't talk about it anymore here. Please refer to Joomla own documentation for this.

The remaining of this page talks about modifying strings found in *.json files only.

Here is an example of a *.json (partial) content, from the common.json file:

{
  "base": {
    "yes": "Yes",
    "no": "No",
    "ok": "OK",
    "auto": "Auto",
    "enabled": "Enabled",
    "disabled": "Disabled",
    "none": "None",
    "details": "Details",
    "required": "required",
    "from": "From",
    "to": "To",
    "done": "Done!",
    "reset": "Reset!",
    "doNotChange": "Do not change",
    "default": "Default",
    "custom": "Custom"
  },
  "operators": {
    "equals": "=",
    "different": "Different",
    "greater": "Greater",
    "greaterEq": "Greater or =",
  ....

Source file location

All the JSON files released with 4Command are found in this directory:

/plugins/system/forcommand/vendor/weeblr/forcommand/locales

Below this root directory, you'll see a series of subfolders, named with the corresponding language code:

/plugins/system/forcommand/vendor/weeblr/forcommand/locales/ar
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/cs
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/da
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/de
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/en
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/es
....

In each folder, you'll see one or more json files such as:

admin.json
common.json
forcommand.json

Source language

The source, official, strings are always the en directory.

Do not modify any of the files directly

If you want to change translations found in these files, or add a new language, do not do that directly in the /plugins/system/forcommand/vendor/weeblr/forcommand/locales directory. Any change you make here will be deleted at next update.

Please read on to learn how to safely add your own translations.

Overriding existing translations

To make the process easier, 4Command lets you change translations using 2 different methods:

Override translations with files

Very similar to how you can create template or layout overrides in your template, you can change existing translations by copying the source file in a given specific directory and modifying it there.

Let's look at 2 scenariis:

Change one or more strings

Assuming you want to change the French translation for base.yes, the steps are:

  • create a directory:
/libraries/weeblr/forcommand/locales/fr/
  • create a file called:
admin.json
  • enter this content:
{
  "base": {
    "yes": "my french translation for Yes",
  }
}
  • save the file, that's all.

Pay attention to matching { and } characters exactly else your override won't be taken into account

Instead of creating the content of that file and adding a single override, you could also copy the entire source file and modify one or a few lines in that copy.

This works, but it not the best approach because it will prevent future improvement in our translation that we could do to work, as your overrides have priority. It's also slightly slower.

Add translation for a new language

This works exactly as the previous example except you put your translations in a new dedicated folder:

Assumning you want to add a translation for the Greek language, from Greece, which full language tag is: el-GR, do the following:

  • create one of these 2 directories:
/libraries/weeblr/forcommand/locales/el-GR/

or

/libraries/weeblr/forcommand/locales/el/
  • copy the source file you want to translate from:
/plugins/system/forcommand/vendor/weeblr/forcommand/locales/en
  • start translating this copy content

That's all!

You can have both el-GR and el directories, with different translations and content. If the Joomla site language is set exactly to el-GR, the translations in that directory will have precedence.

If the site language is set to something else, for instance el-CY, then your el-GR translation won't be used but if you have one in el, it will be used the same for el-GR and el-CY, as el is the language "family" code.

The standard Joomla language strings override mechanism

You access it through System | Language Overrides in Joomla 4+, and it lets you define a new translation for a given string key.

  • Using to override 4Command language strings found in *.ini is standard Joomla procedure so, again, please refer to Joomla own documentation for this.
  • Using it to override 4Command strings in *.json works nearly the same, except when building the string key.

Looking back at the example of a *.json file, we can see a difference in how the keys are organized compared to Joomla *.ini keys: 4Command keys have 2 levels, whereas Joomla keys are always one level:

PLG_SYSTEM_FORCOMMAND = "System - 4Command"
PLG_SYSTEM_FORCOMMAND_XML_DESCRIPTION = ""
PLG_SYSTEM_FORCOMMAND_PRIVACY_CAPABILITIES = "4Command does not store private personal information."

Keys used by Weeblr's applications are 2 levels, for instance:

base.yes

Therefore, to build the language strings to use on Joomla text override page, the key for our example must be built as follows:

COM_FORCOMMAND_BASE__YES

Note there are 2 _ characters between "BASE" and "YES", this is what represents the secondary level.

Aside from this quirk in selecting the key, the rest of the process is the same as usual when overriding Joomla language strings.