Skip to content

Commit 4e31aea

Browse files
committed
Switch to gen-i18n script
1 parent 6910b83 commit 4e31aea

3 files changed

Lines changed: 220 additions & 218 deletions

File tree

docs/translating-dev.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ function getColorName(hex) {
2828

2929
## Adding new strings
3030

31-
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements. Also import `_td` if needed.
32-
2. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method). If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time.
33-
3. Add the String to the ``en_EN.json`` file in ``src/i18n/strings`` (respect which repository you are on).
31+
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements. Also import `_td` if needed.
32+
1. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method). If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time.
33+
1. Run `npm run i18n` to update ``src/i18n/strings/en_EN.json`` (if it fails because it can't find the script, your dev environment predates the script, so reinstall/link react-sdk with `npm link ../matrix-react-sdk`).
34+
1. If you added a string with a plural, you can add other English plural variants to ``src/i18n/strings/en_EN.json`` (remeber to edit the one in the same project as the source file containing your new translation).
3435

3536
## Adding variables inside a string.
3637

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"scripts": {
2929
"reskindex": "reskindex -h src/header",
3030
"reskindex:watch": "reskindex -h src/header -w",
31+
"i18n": "matrix-gen-i18n",
3132
"build:res": "node scripts/copy-res.js",
3233
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
3334
"build:compile": "npm run reskindex && babel --source-maps -d lib src",

0 commit comments

Comments
 (0)