Adding new translations or modifying existing ones.
4SEF 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 4SEF to better fit your needs.
To that effect, adding new, or overriding existing translations is possible in several ways.
Types of translations
4SEF uses 2 types of translations files:
- Joomla standard
*.ini
files are used for a few strings, mostly when 4SEF 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 4SEF and contains anything you see displayed in the 4SEF user interface
As overriding 4SEF 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 4SEF are found in this directory:
/plugins/system/forsef/vendor/weeblr/forsef/locales
Below this root directory, you'll see a series of subfolders, named with the corresponding language codes:
/plugins/system/forsef/vendor/weeblr/forsef/locales/ar
/plugins/system/forsef/vendor/weeblr/forsef/locales/cs
/plugins/system/forsef/vendor/weeblr/forsef/locales/da
/plugins/system/forsef/vendor/weeblr/forsef/locales/de
/plugins/system/forsef/vendor/weeblr/forsef/locales/en
/plugins/system/forsef/vendor/weeblr/forsef/locales/es
....
In each folder, you'll see one or more json files such as:
admin.json
common.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/forsef/vendor/weeblr/forsef/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, 4SEF 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/forsef/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/forsef/locales/el-GR/
or
/libraries/weeblr/forsef/locales/el/
- copy the source file you want to translate from:
/plugins/system/forsef/vendor/weeblr/forsef/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 4SEF language strings found in
*.ini
is standard Joomla procedure so, again, please refer to Joomla own documentation for this. - Using it to override 4SEF 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: 4SEF keys have 2 levels, whereas Joomla keys are always one level:
PLG_SYSTEM_FORSEF = "System - 4SEF"
PLG_SYSTEM_FORSEF_XML_DESCRIPTION = ""
PLG_SYSTEM_FORSEF_PRIVACY_CAPABILITIES = "4SEF 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_FORSEF_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.
4SEF translators credits
4SEF was translated in part by a group of Joomla! enthousiasts:
Danish
Ronny Buelund
I have been working with Joomla since version 1.x - I am maintaining the danish Joomla core translation, and translations for several small and big extensions. I have also developed several extensions for Joomla, eg a system for small schools to creta timetables for the students.
Dutch
Davy Renckens
Webdesigner / offiRent verhuur van maatschappelijke zetels en virtuele kantoren in België en Nederland.
- https://www.offirent.be
- https://twitter.com/offirent
- https://www.facebook.com/offiRentBE/
- https://www.instagram.com/Offirent/
- https://www.linkedin.com/company/offirent
French
Yannick Gaultier
Russian
Алексей Хорошевский (Aleksej Khoroshevskij)
Since about 2008 to the present day, I have been developing websites on Joomla and WebSite X5. I have a blog about Joomla extensions and other software since 2010. I write blog posts myself. In addition, I post my own interfaces translations of various Joomla extensions in Russian and Ukrainian.
Slovak
Lubos
Turkish
Mehmet Taş
Matematik Öğretmeni, Web Tasarımcısı