aboutsummaryrefslogtreecommitdiff
path: root/doc/translation_strings_policy.md
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-15 08:40:15 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-15 08:43:56 +0200
commit06818f7145cac51529b07f9cade5e16dabc22d29 (patch)
treeba8b05cc143379b7fb99cf5889306e981088138a /doc/translation_strings_policy.md
parentab0ec6790355473e96176ec3c2c2b1564ddb296d (diff)
downloadbitcoin-06818f7145cac51529b07f9cade5e16dabc22d29.tar.xz
doc: Add section on plurals to strings policy
Thanks to @pryds for explaining this to me on Transifex.
Diffstat (limited to 'doc/translation_strings_policy.md')
-rw-r--r--doc/translation_strings_policy.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/translation_strings_policy.md b/doc/translation_strings_policy.md
index 6824b1d8ef..cf72a55b20 100644
--- a/doc/translation_strings_policy.md
+++ b/doc/translation_strings_policy.md
@@ -64,6 +64,44 @@ Avoid dividing up a message into fragments. Translators see every string separat
There have been difficulties with use of HTML in translation strings; translators should not be able to accidentally affect the formatting of messages.
This may sometimes be at conflict with the recommendation in the previous section.
+### Plurals
+
+Plurals can be complex in some languages. A quote from the gettext documentation:
+
+ In Polish we use e.g. plik (file) this way:
+ 1 plik,
+ 2,3,4 pliki,
+ 5-21 pliko'w,
+ 22-24 pliki,
+ 25-31 pliko'w
+ and so on
+
+In Qt code use tr's third argument for optional plurality. For example:
+
+ tr("%n hour(s)","",secs/HOUR_IN_SECONDS);
+ tr("%n day(s)","",secs/DAY_IN_SECONDS);
+ tr("%n week(s)","",secs/WEEK_IN_SECONDS);
+
+This adds `<numerusform>`s to the respective `.ts` file, which can be translated separately depending on the language. In English, this is simply:
+
+ <message numerus="yes">
+ <source>%n active connection(s) to Bitcoin network</source>
+ <translation>
+ <numerusform>%n active connection to Bitcoin network</numerusform>
+ <numerusform>%n active connections to Bitcoin network</numerusform>
+ </translation>
+ </message>
+
+Where it is possible try to avoid embedding numbers into the flow of the string at all. e.g.
+
+ WARNING: check your network connection, %d blocks received in the last %d hours (%d expected)
+
+versus
+
+ WARNING: check your network connection, less blocks (%d) were received in the last %n hours than expected (%d).
+
+The second example reduces the number of pluralized words that translators have to handle from three to one, at no cost to comprehensibility of the sentence.
+
### String freezes
During a string freeze (often before a major release), no translation strings are to be added, modified or removed.