Fluent: Making a new translation
Michael Stegeman edited this page Dec 17, 2019
·
3 revisions
Pages 40
Clone this wiki locally
Pontoon
Translations can be added via Pontoon: https://pontoon.mozilla.org/projects/webthings-gateway/
Old Instructions
- Start in the WebThings Gateway repository: https://github.com/mozilla-iot/gateway
- Copy
static/fluent/en-US/main.ftl
tostatic/fluent/<your language>/main.ftl
- Translate the text in that file
- Perform the following code changes
Add the language to availableLanguages
in static/js/fluent.js
:
const availableLanguages = {
de: ['/fluent/de/main.ftl'],
'en-US': ['/fluent/en-US/main.ftl'],
en: ['/fluent/en-US/main.ftl'],
fr: ['/fluent/fr/main.ftl'],
'fy-NL': ['/fluent/fy-NL/main.ftl'],
it: ['/fluent/it/main.ftl'],
ja: ['/fluent/ja/main.ftl'],
nl: ['/fluent/nl/main.ftl'],
pl: ['/fluent/pl/main.ftl'],
ru: ['/fluent/ru/main.ftl'],
sr: ['/fluent/sr/main.ftl'],
// your language
};
Add the language to l10n.toml
:
locales = [
"de",
"fr",
"fy-NL",
"it",
"ja",
"nl",
"pl",
"ru",
"sr",
# your language
]
Modify the country code in that file's load()
function if you want to test it out
language = 'your language'; // response.current || navigator.language || 'en-US';