This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Translations guideline
Torsten Schlett edited this page Nov 5, 2018
·
12 revisions
This page gathers guidelines and conventions for translations within geli.
You can find the translation files here:
- English: /app/Webfrontend/src/assets/i18n/en.json
- German: /app/Webfrontend/src/assets/i18n/de.json
If you work at a part or component of geli, please follow the next steps:
- DO NOT hardcode any texts in one language
- use the translate pipe and attributes for texts in frontend
- search first in the xy.json if the translation attribute already exists
- the translation files are sorted alphabetically at the moment -> please keep this sorting !
- also the translation jsons contain a hierarchy -> please use
- most important: if you add one translation to a json, complete the other jsons also ! (if you are not able to translate an expression in any language, please note the English version nonetheless and report the line to another team member for translation.)
- if there are translations missing or wrong -> add or correct it !
Feel free to extend the examples. ;-)
- HTML:
{{ 'common.cancel' | translate }}
- TS:
- import: import {TranslateService} from '@ngx-translate/core';
- add "public translate: TranslateService" to constructor
- add the following initialization to ngOnInit():
const lang = localStorage.getItem('lang') || this.translate.getBrowserLang() || this.translate.getDefaultLang();
this.translate.use(lang);
- use translate. example:
this.translate.get(['common.content', 'common.general']).subscribe((t: string) => {
this.tabs.push({ path: '.', label: t['common.general'] });
this.tabs.push({ path: 'content', label: t['common.content'] });
});