From fc96d7137dcf002ad6b1f88d7b7447d82b0e4647 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 14 Feb 2021 09:58:55 -0800 Subject: [PATCH] docs: add better docs on internationalization (#1932) [skip ci] --- CONTRIBUTING.md | 10 ++++------ docs/Internationalization.md | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 docs/Internationalization.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f32534d..0d993345 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,5 @@ # Contributing to Pinafore -## Internationalization - -To contribute or change translations for Pinafore, look in the [src/intl](https://github.com/nolanlawson/pinafore/tree/master/src/intl) directory. Create a new file or edit an existing file based on its [two-letter language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and optionally, a region. For instance, `en-US.js` is American English, and `fr.js` is French. - -The default is `en-US.js`, and any strings not defined in a language file will fall back to the strings from that file. - ## Installing To install with dev dependencies, run: @@ -95,6 +89,10 @@ The tests have a naming convention: In principle the `0-` tests don't have to worry about clobbering each other, whereas the `1-` ones do. +### Internationalization + +See [Internationalization.md](https://github.com/nolanlawson/pinafore/blob/master/docs/Internationalization.md). + ### Mastodon used for testing There are two parts to the Mastodon data used for testing: diff --git a/docs/Internationalization.md b/docs/Internationalization.md new file mode 100644 index 00000000..a62df9bd --- /dev/null +++ b/docs/Internationalization.md @@ -0,0 +1,20 @@ +# Internationalization + +To contribute or change translations for Pinafore, look in the [src/intl](https://github.com/nolanlawson/pinafore/tree/master/src/intl) directory. Create a new file or edit an existing file based on its [two-letter language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and optionally, a region. For instance, `en-US.js` is American English, and `fr.js` is French. + +The default is `en-US.js`, and any strings not defined in a language file will fall back to the strings from that file. + +There is also an `intl/emoji-picker` directory, which contains translations for [emoji-picker-element](https://github.com/nolanlawson/emoji-picker-element) +(which already comes with English built-in). + +Note that internationalization is currently experimental. Client-side locale switching is not supported – when you build +the instance of Pinafore, it is either one language or another. To build in a particular language, use (for example): + + LOCALE=fr yarn build + +or + + LOCALE=fr yarn dev + +There is also an experimental `LOCALE_DIRECTION` environment variable for the direction (LTR versus RTL) which is +exposed to the source code while building.