Олег Нечаев
Олег Нечаев

Reputation: 69

How to add another localization to SULU CMS (System Language)?

I need to add "ru" content localization. So I changed the following fragment:

<localizations>
    <localization language="ru" default="true"/>
</localizations>

Then I ran the following command:

php bin/adminconsole sulu:document:initialize

After that, I replaced all the values of a "lang" attributes from "en" to "ru" in all xml-files inside config/templates/pages directory.

But all pages in the administration interface now have empty labels.

I tried changing the value of the "System Language" field in the permissions tab of the contacts to "English". I also reverted all xml-files inside config/templates/pages directory (from "ru" to "en"). Thus the fields become displayed.

So how can I add Russian localization in the "System language" field to solve my problem?

enter image description here

Upvotes: 1

Views: 1243

Answers (1)

Daniel Rotter
Daniel Rotter

Reputation: 2056

Sulu Core Developer here 🙂

What you have added is another content language, which describes in which languages the page, media, articles and so on can be translated. These languages also appear in the dropdown on the very right of the top toolbar.

However, this language only is about the values the content manager is filling into the fields. All the labels, navigation items and other texts that appear in the UI are displayed based on the system language of the user. Each user can choose their system language in the profile overlay, which will be shown when the name of the user is clicked on the left navigation.

System Language of the user

So in order to see the ru titles you have added to the page XML files, the user needs to choose ru as language.

Unfortunately this language does not exist by default in Sulu. So what you can do is to add this language using the configuration in config/packages/sulu_admin.yaml.

sulu_core:
    locales:
        en: English
        de: Deutsch
        ru: Russian
    translations:
        - en
        - de
        - ru

Afterwards you can download a language using the sulu:admin:download-language command:

bin/console sulu:admin:download-language ru

This will try to download the russian language from our Crowdin Project, which is a crowdsourced translation platform. But I am sorry to say, that the russian translation does not exist there yet. If you want to contribute it, let us know, and we will create the russian language, so that you can start translating it.

If you really just want to add russian titles to the labels, you can still write the YAML configuration as above, and you will see them, when the user chose russian as their system language. All the other texts will fallback to english in that case.

Upvotes: 5

Related Questions