feat(i18n) Custom i18n strings (#4000)

* Custom i18n strings (and some code formatting)

* Documentation for per-instance l10n overwrites
This commit is contained in:
Daniel Krol 2020-05-19 08:21:31 -04:00 committed by GitHub
parent 170f471299
commit 61c7bb9699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 6 deletions

View file

@ -92,3 +92,23 @@ For example, if you want to replace `Chat` with `Notes`, simply add...
, "pad.chat": "Notes"
}
```
## Customization for Administrators
As an Etherpad administrator, it is possible to overwrite core mesages as well as messages in plugins. These include error messages, labels, and user instructions. Whereas the localization in the source code is in separate files separated by locale, an administrator's custom localizations are in `settings.json` under the `customLocaleStrigns` key, with each locale separated by a sub-key underneath.
For example, let's say you want to change the text on the "New Pad" button on Etherpad's home page. If you look in `locales/en.json` (or `locales/en-gb.json`) you'll see the key for this text is `"index.newPad"`. You could add the following to `settings.json`:
```
"customLocaleStrings": {
"fr": {
"index.newPad": "Créer un document"
},
"en-gb": {
"index.newPad": "Create a document"
},
"en": {
"index.newPad": "Create a document"
}
}
```