From 1e2e4397f709f3455994a1a98b88188491c8984b Mon Sep 17 00:00:00 2001 From: pafcu Date: Thu, 16 Nov 2017 12:41:26 +0100 Subject: [PATCH] Fix typo --- docs/translating-dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/translating-dev.md b/docs/translating-dev.md index a39fe82c..3209f1e4 100644 --- a/docs/translating-dev.md +++ b/docs/translating-dev.md @@ -40,7 +40,7 @@ function getColorName(hex) { 1. Add it to the array in ``_t`` for example ``_t(STRING, {variable: this.variable})`` 1. Add the variable inside the string. The syntax for variables is ``%(variable)s``. Please note the _s_ at the end. The name of the variable has to match the previous used name. -- You can use the special ``count`` variable to choose between multiple versions of the same string, in order to get the correct pluralization. E.g. ``_t('You have %(count)s new messages', { count: 2 })`` would show 'You have 2 new messages', while ``_t('You have %(count)s new messages', { count: 1 })`` would show 'You have one new message' (assuming a singular version of the string has been added to the translation file. See above). Passing in ``count`` is much prefered over having and if-statement choose the correct string to use, because some languages have much more complicated plural rules than english (e.g. they might need a completely different form if there are three things rather than two). +- You can use the special ``count`` variable to choose between multiple versions of the same string, in order to get the correct pluralization. E.g. ``_t('You have %(count)s new messages', { count: 2 })`` would show 'You have 2 new messages', while ``_t('You have %(count)s new messages', { count: 1 })`` would show 'You have one new message' (assuming a singular version of the string has been added to the translation file. See above). Passing in ``count`` is much prefered over having an if-statement choose the correct string to use, because some languages have much more complicated plural rules than english (e.g. they might need a completely different form if there are three things rather than two). - If you want to translate text that includes e.g. hyperlinks or other HTML you have to also use tag substitution, e.g. ``_t('Click here!', {}, { 'a': (sub) => {sub} })``. If you don't do the tag substitution you will end up showing literally '' rather than making a hyperlink. - You can also use React components with normal variable substitution if you want to insert HTML markup, e.g. ``_t('Your email address is %(emailAddress)s', { emailAddress: {userEmailAddress} })``.