Skip to content

Commit

Permalink
Reorder sections in translating documentation
Browse files Browse the repository at this point in the history
Move "Editing existing strings" to after "Adding new strings".
  • Loading branch information
aidalgol committed Apr 29, 2018
1 parent c26cde2 commit 95b09cd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/translating-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ function getColorName(hex) {
}
```

## Editing existing strings

1. Edit every occurrence of the string inside `_t()` and `_td()` in the JSX files.
1. Run `npm run i18n` to update `src/i18n/strings/en_EN.json`. (Be sure to run this in the same project as the JSX files you just edited.)
1. Run `npm run prunei18n` to remove the old string from `src/i18n/strings/*.json`.

## Adding new strings

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.
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.
1. Run `npm run i18n` to update ``src/i18n/strings/en_EN.json``
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).

## Editing existing strings

1. Edit every occurrence of the string inside `_t()` and `_td()` in the JSX files.
1. Run `npm run i18n` to update `src/i18n/strings/en_EN.json`. (Be sure to run this in the same project as the JSX files you just edited.)
1. Run `npm run prunei18n` to remove the old string from `src/i18n/strings/*.json`.

## Adding variables inside a string.

1. Extend your ``_t()`` call. Instead of ``_t(STRING)`` use ``_t(STRING, {})``
Expand Down

0 comments on commit 95b09cd

Please sign in to comment.