In the previous example of manifest.json, we've seen that certain parameters require values in the form of widget.name, widget.description, advanced.title. These values are necessary if the widget is designed to support multiple languages.

In such cases, you need to create localization files for each supported language. Kommo currently supports English, Spanish, and Portuguese languages, and the files should be named en.json, es.json, and pt.json respectively. These files should be placed in the i18n folder. Depending on the account's language, messages will be displayed in the appropriate language for both the UI/UX and the backend.

👉

If you are using two localizations, both i18n files must have the same structure.

Example

i18n/en.json

{
    "widget":{
        "name":"My Widget",
        "short_description":"Short description",
        "description":"Full description",
        "tour_description":"Tour description"
    },
    "settings":{
        "login":"User login",
        "api_key":"API key",
        "account":"Account"
    }
}

i18n/es.json

{
    "widget":{
		"name":"Mi Widget",
        "short_description":"Descripción corta",
        "description":"Descripción completa",
        "tour_description":"Descripción de Tour"
    },
    "settings":{
        "login":"Inicio de sesión",
        "api_key":"Clave API",
        "account":"Cuenta"
    }
}

These localizations will appear in the settings of the integration modal window in the two languages.

In English

In English

In Spanish

In Spanish

Furthermore, the localization files are used in the widget's JavaScript part. To extract an object from the language files, you should use self.i18n('key'), where 'key' is the name of the object you want to extract and its value is present in the localization file.

For instance, if you want to get the widget name in the JS, you can use self.i18n('widget').name.

You can find more information about this method in the widget's script.JS.


What’s Next