Backend
How to translate backend and embed parts
The backend (the server part) and the embedded comment engine share the same set of so-called messages, all of them located under resources/i18n/
in the project root.
You can see the list of available languages by logging into the Administration UI as a superuser and navigating to Configuration
⇒ Static
: the section Available UI languages
lists all installed translations.
Each translation is a text-based YAML file, providing a mapping between Message ID and Message translation. The file name must be a RFC 5646 tag of the target language, and its extension yaml
. For example:
ru.yaml
for Russianen.yaml
for Englishen-gb.yaml
for British Englishpt.yaml
for Portuguese (Portugal)pt-br.yaml
for Brazilian Portuguese
Here’s an example for English:
# en.yaml
- {id: accountCreatedConfirmEmail, translation: Account is successfully created. Please check your email and click the confirmation link it contains.}
- {id: actionAddComment, translation: Add Comment}
- {id: actionApprove, translation: Approve}
- {id: actionCancel, translation: Cancel}
And below is an example how the same messages look in Russian:
# ru.yaml
- {id: accountCreatedConfirmEmail, translation: Аккаунт успешно зарегистрирован. Мы отправили вам емэйл, пожалуйста, подтвердите свой адрес, перейдя по содержащейся в нём ссылке.}
- {id: actionAddComment, translation: Добавить комментарий}
- {id: actionApprove, translation: Утвердить}
- {id: actionCancel, translation: Отмена}
Process
If you’d like to contribute your own translation for a language that is missing, follow these steps:
- Fork the Comentario repository.
- Make a copy of an existing translation (
resources/i18n/en.yaml
is always the most complete one) into a newresources/i18n/<language_tag>.yaml
. - Translate every message.
- Modify the file
cypress/support/cy-utils.ts
by adding your new language spec to the constantUI_LANGUAGES
: it’s used in end-2-end tests to verify every available language. - Commit both files into your fork.
- Make sure the build pipeline has finished successfully.
- Submit a Merge Request for merging your changes into the
dev
branch.