This guide demonstrates different ways of Translating and editing language files (.po and .mo), translations of themes, plugins and core.
Free translation plugin – Make sure to check DeepL Translation Plugin that helps to translate whole Osclass, plugins and themes in few minutes for free! Translations are high-quality using advanced AI with very close performance to human or Chat-GPT.
How to completely translate your classifieds into different language?
First and most important information to highlight is, what you need to translate to get your marketplace into desired language:
- Osclass core – includes core, backoffice and messages
- Active theme – other themes does are not active does not need to be translated
- All active plugins – each plugin has own translation file and set of strings
- Dynamic content – categories, email templates, admin-managed plugin data – translated from Osclass backoffice in relevant section
Core, theme and plugin translations can be translated from Osclass backoffice > International > Translations or using tools like PO Edit.
If you miss one or more translations, you will still see text in English! Continue reading to get more details about each section and best way to manage translations.
Translations in backoffice
In Osclass 8.1.0 and later, it is possible to translate themes, plugins and Osclass core directly in backoffice, without need to find/allocate .po and .mo files or use external program or service.
To enter translation section, navigate to International > Translations.
Note: Save translations regularly, set PHP variable max_input_vars to large number, ideally 10000 or more, as each translation object takes at least 1 input. If you have 1000 translation terms, but max_input_vars is 500 only, translations will save up to limit of 500, others will be lost!
Anyway, large translations may be more comfortable to be done in tools like POEdit (section below).
Where to find language files
To completely translate Osclass into new language, it is required to translate files in multiple locations. You can download existing Osclass translations here or from Market section in your oc-admin.
Osclass use for .mo file as source of translations. As .mo file is not well readable by humans, .po file should always be delivered with .mo file (located in same folder with same name).
Definitions:
- .mo file – binary file (machine readable). This is the actual file used by Osclass and is compiled from the .po file.
- .po file – ASCII file (readable text). It’s responsible for most of the text displayed on the website. This is the file that will be edited.
- .pot file – Template for .po file (optional)
In some cases there is .pot file available in translation folder as well. This one is simply template for .po file, Osclass is not using it.
Anyway it is good to remember:
- .po file is used by translator to translate strings into different language (i.e. using Poedit free program)
- Osclass does not use .po file at all
- .mo file is generated when .po file updates are made.
- You should check if .mo file has been updated (together with .po) and has similar size as .po file, when updates in .po file are saved
- Osclass use .mo file as source of translations
Core translations
Core translation pack contains most of files comparing theme/plugins translations.
- core.mo, core.po – translations from core files (oc-includes, oc-admin folders)
- messages.mo, messages.po – translation of flash messages (or any other strings used as message or notification)
- theme.mo, theme.po – translations of default osclass theme (contains translations of bender & sigma themes)
- index.php – specification of language
- mail.sql – translations of email templates (note you will be able to translate email templates also from backoffice)
Backoffice translations
Translations of backoffice should be needed just in case you use different backoffice theme than default one (otherwise contained in core translations).
If yes, translation files are located in folder oc-admin/themes/{theme_name}/languages/{language_code}/ and you should have there theme.mo and theme.po files.
Plugin translations
Each plugin should be translated, English language files should be created by author and located in:
- oc-content/plugins/{plugin_name}/languages/en_US/
There should be 2 files:
- messages.mo
- messages.po
Theme translations
Theme should be translated in case you are using different then default theme (otherwise translations are in core translations). English language files should be created by author and located in:
- oc-content/plugins/{theme_name}/languages/en_US/
There should be 2 files:
- theme.mo
- theme.po
Create new language files if they do not exist
Best way is to copy existing translation files for different language and adjust it to yours. You will need to know proper language code Osclass should use, as all other translations (plugins, themes) will need to use same code. (i.e. en_US, ja_JA, cz_CS, …)
Update translations with missing or not actual strings
Sometimes it happens that language file (.po, .mo) is missing particular strings or some of them are already obsolete (i.e. if you translated v1.0 and there is v2.0 of plugin/theme already). Easiest way to fix this is update translation list from source code.
This is very simple action when using Poedit program (free). Simply open .po file and from top menu select “Translation > Update from source code …”.
In some cases .po file many not reference to proper folder (source code), in this case go to “Translation > Properties” and in “Source paths” select plugin/theme folder and in “Source keywords” you should have these entries (functions):
- __
- _e
- _m
Make sure to save .po file before updating it from source code.
Making translation – editing .po file
Open .po file you want to translate in Poedit. Click on “Source text” of entry you want to translate (you will see existing translations in “Translation” column right to “Source text”).
You can now define translation at bottom of window in “Translation” box.
You may continue to edit strings by repeating the above procedure. Once you’re done editing, click “File > Save”
By saving, the program will automatically create/update .mo file with your translations based on .po file. This file will appear in the same location on your computer as .po file.
Showcase of translation
Let’s say we want to translate Osclass Pay Plugin from English to Italian language. Here is procedure to follow:
- Download folder oc-content/plugins/osclass_pay/languages/en_US into your computer/desktop
- Rename folder to it_IT (because Italian language code in Osclass is it_IT)
- Open messages.po file in it_IT folder
- Translate it
- Save it
- Once saved, .mo & .po files are updated. You should see this based on timestamps (last update) of files. Make sure .mo file was updated!
- Upload folder back to your server/hosting into oc-content/plugins/osclass_pay/languages folder
- Now you should see in languages folder 2 subfolders: en_US and it_IT
- Go to your website and switch to Italian language. All strings you’ve translated will not show in Italian language.
In order to completely translate Osclass into Italian (in this case), you should now repeat this procedure with:
- core translation files
- active theme translation files
- enabled & installed plugin translation files