This tutorial guides you through the steps necessary to make language-dependent texts of your plugin, such as input labels or tooltips of the plugin configuration, editable in the plentymarkets multilingualism interface. The multilingualism interface displays the language-dependent texts of your plugin in a bilingual view, in which users can edit and translate them to display them in various languages in their online store. In the multilingualism interface the language-dependent texts are organised in sections, so that users can easily find the texts they want to edit.
In order to make texts of your plugin editable in the multilingualism interface, your plugin needs to include the files Template.properties, Config.properties and translation.json. Your folder structure should look like this:
MyPlugin/ ├── resources/ │ └── lang/ | ├── en/ │ | └── config.properties // contains the section names │ | └── template.properties // contains the translation keys and texts grouped according to prefixes │ | │ └── de/ | └── config.properties // contains the section names | └── template.properties // contains the translation keys and texts grouped according to prefixes | | └── translation.json // contains sections keys, section prefixes and untranslatable keys
The Template.properties file contains all of the language-dependent translation keys of your plugin. You save the Template.properties file in a sub-folder of your resources/lang folde, e.g. resources/lang/en for texts in English. Within the Template.properties file, you organise the translation keys into sections according to prefixes. For instance, you could group all text elements that pertain to the contact page by adding contact as a prefix to the language keys:
MyPlugin/resources/lang/en/Template.properties
; contact - Contact page contact = "Contact" contactName = "Name" contactMail = "Email" contactMessage = "Message" contactShopMessage = "You have a question? Simply fill out the form and we will respond to your request as soon as possible."
The Config.properties file contains the keys and texts for the section names of your plugin and is located in the relevant sub-folder of the resource/lang folder. You should try to label your sections unambiguously, so that users can clearly identify which part of your plugin the section names refer to. The section names in the Config.properties cannot be edited in the multilingualism interface.
MyPlugin/resources/lang/en/Config.properties
; sections address = "Address" contact = "Contact" notifications = "Notifications" termsAndConditions = "Terms and conditions"
The translation.json file brings together the elements from the Template.properties and Config.properties files. It lists the sections, whose names are adopted from the Config.properties file, and the prefixes, along which the translation keys are organised in the Template.properties file.
MyPlugin/translation.json
{ "sections": [ { "name": "Config.address", "prefix": "address" }, { "name": "Config.contact", "prefix": "contact" }, { "name": "Config.notifications", "prefix": "notifications" }, { "name": "Config.termsAndConditions" "prefix": "termsAndConditions" } ] }
If you want to prevent users from editing and translating certain text elements of your plugin, such as brand names, you can include a separate array in the translation.json file, in which you list the keys. These keys will appear in the multilingualism interface, but users will not be able to interact with the text element.
MyPlugin/translation.json
{ "sections": [ { "name": "Config.contact", "prefix": "contact" } ], "nonTranslatableKeys":[ "brandName1", "brandName2" ] }