diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index d220bfa740..f9d1dbbc47 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2363,6 +2363,58 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) ... +
+ The english language is very simple when it comes to plurals.
+ You have 0 elephants
, 1 elephant
, or 2+ elephants
. So basically you have 2 different forms: one singular and one plural.
+ But for some other languages this is quite more difficult. Let's take the Bosnian language as another example:
+ You have [1/21/31] slon
, [2/3/4] slona
, [0/5/6] slonova
and [7/8/9/11] ...
and some more difficult rules.
+
Therefor we introduced a plural system that deals with this kind of problems.
+ +The php Code will basically look like this:
+ ++ ... + $user->lang('NUMBER_OF_ELEFANTS', $number_of_elefants); + ... +
And the English translation would be:
+ ++ ... + 'NUMBER_OF_ELEFANTS' => array( + 0 => 'You have no elephant', // Optional special case for 0 + 1 => 'You have 1 elephant', // Singular + 2 => 'You have %d elephant', // Plural + ), + ... +
While the Bosnian translation can have more cases:
+ ++ ... + 'NUMBER_OF_ELEFANTS' => array( + 0 => 'You have no slonova', // Optional special case for 0 + 1 => 'You have %d slon', // Used for 1, 21, 31, .. + 2 => 'You have %d slona', // Used for 5, 6, + 3 => ... + ), + ... +
NOTE: It is okay to use plurals for an unknown number compared to a single item, when the number is not known and displayed:
++ ... + 'MODERATOR' => 'Moderator', // Your board has 1 moderator + 'MODERATORS' => 'Moderators', // Your board has multiple moderators + ... +