aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/docs/coding-guidelines.html
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-18 10:14:11 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-18 10:14:11 +0100
commit6750e19214d3770280c729a4f85c96fd972d92c5 (patch)
treeb83551946d7a7506f34076ce4e50a902190ca649 /phpBB/docs/coding-guidelines.html
parent244d783865a881d68c906e32352476ab69e1cf4e (diff)
downloadforums-6750e19214d3770280c729a4f85c96fd972d92c5.tar
forums-6750e19214d3770280c729a4f85c96fd972d92c5.tar.gz
forums-6750e19214d3770280c729a4f85c96fd972d92c5.tar.bz2
forums-6750e19214d3770280c729a4f85c96fd972d92c5.tar.xz
forums-6750e19214d3770280c729a4f85c96fd972d92c5.zip
[ticket/12286] Add section about plurals to the coding guidelines
PHPBB3-12286
Diffstat (limited to 'phpBB/docs/coding-guidelines.html')
-rw-r--r--phpBB/docs/coding-guidelines.html52
1 files changed, 52 insertions, 0 deletions
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))
...
</pre></div>
+ <h4>Using plurals:</h4>
+
+ <p>
+ The english language is very simple when it comes to plurals.<br />
+ You have <code>0 elephants</code>, <code>1 elephant</code>, or <code>2+ elephants</code>. So basically you have 2 different forms: one singular and one plural.<br />
+ But for some other languages this is quite more difficult. Let's take the Bosnian language as another example:<br />
+ You have <code>[1/21/31] slon</code>, <code>[2/3/4] slona</code>, <code>[0/5/6] slonova</code> and <code>[7/8/9/11] ...</code> and some more difficult rules.
+ </p>
+
+ <p>Therefor we introduced a <a href="https://wiki.phpbb.com/Plural_Rules">plural system</a> that deals with this kind of problems.</p>
+
+ <p>The php Code will basically look like this:</p>
+
+ <div class="codebox"><pre>
+ ...
+ $user->lang('NUMBER_OF_ELEFANTS', $number_of_elefants);
+ ...
+ </pre></div>
+
+ <p>And the English translation would be:</p>
+
+ <div class="codebox"><pre>
+ ...
+ '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
+ ),
+ ...
+ </pre></div>
+
+ <p>While the Bosnian translation can have more cases:</p>
+
+ <div class="codebox"><pre>
+ ...
+ '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 => ...
+ ),
+ ...
+ </pre></div>
+
+ <p><strong>NOTE:</strong> It is okay to use plurals for an unknown number compared to a single item, when the number is not known and displayed:</p>
+ <div class="codebox"><pre>
+ ...
+ 'MODERATOR' => 'Moderator', // Your board has 1 moderator
+ 'MODERATORS' => 'Moderators', // Your board has multiple moderators
+ ...
+ </pre></div>
+
<a name="writingstyle"></a><h3>6.iii. Writing Style</h3>
<h4>Miscellaneous tips &amp; hints:</h4>