ncase / trust

An interactive guide to the game theory of cooperation
Creative Commons Zero v1.0 Universal
5.79k stars 922 forks source link

Allow for more than 1 form of plurals #17

Open Minoru opened 7 years ago

Minoru commented 7 years ago

The game currently assumes that a word can be either in a singular or plural form, but in reality it just isn't so in some languages. For example, Russian uses the same word with counts 1, 11 and 121, another with 2 and 3, and yet another with 5. See this oldish article on how Qt framework handles this problem.

Martin819 commented 7 years ago

+1 on this to be solved.

jkoelling commented 7 years ago

Can you maybe get around this problem by rephrasing in a way that works independent of the number? Of course I don't know if this makes sense for your language.

For example, instead of:

<p id="sandbox_rules_1">
Play [N] rounds per match:
</p>
<p id="sandbox_rules_1_single">
Play [N] round per match:
</p>

<p id="sandbox_rules_2">
After each tournament, eliminate the bottom [N] players &amp; reproduce the top [N] players:
</p>
<p id="sandbox_rules_2_single">
After each tournament, eliminate the bottom [N] player &amp; reproduce the top [N] player:
</p>

use the following:

<p id="sandbox_rules_1">
Number of rounds per match: [N]
</p>
<p id="sandbox_rules_1_single">
Number of rounds per match: [N]
</p>

<p id="sandbox_rules_2">
Number of players to eliminate from bottom &amp; reproduce from top after each tournament: [N]
</p>
<p id="sandbox_rules_2_single">
Number of players to eliminate from bottom &amp; reproduce from top after each tournament: [N]
</p>
Martin819 commented 7 years ago

For me, that could probably work. We'll see if I'll run into a situation where it can't be used.

Minoru commented 7 years ago

@jkoelling, we sure can, but:

  1. this usually makes the language less lively and more formal (akin to passive voice in English);
  2. this makes the text longer, and we're pretty tight on space as it is (Russian words are generally longer than English ones).
jkoelling commented 7 years ago

@Minoru I'm aware this is not perfect, but it is a solution that works right now without any changes to the code. You can always come back and change it once someone added a general solution for pluralization.

I thought about doing one myself, but as far as I can tell it affects only two sentences which are basically just labels in the sandbox. You don't loose much, if they are a bit less lively.

If you really want to add correct pluralization for a specific single language, you only need to know a little js and html and change a few lines of code to get it working. Since every language is in it's own repo for now I don't see a problem with changing parts of the code in addition to the translation.

If you need more space, have a look at https://github.com/ncase/trust/issues/19#issuecomment-320930912.