From 87d87e829b2ff78e985c60981aad19e152b367de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 29 Jan 2018 14:34:45 +0100 Subject: [PATCH] Add correct labels for Slovenian alternative plural MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IMHO it's bad idea to be inconsistent with ordering all other languages use, but anyway this has already quite widespread usage. See https://github.com/translate/l10n-guide/issues/22 Signed-off-by: Michal Čihař --- weblate/lang/data.py | 13 +++++++++++- .../migrations/0009_auto_20180129_1434.py | 20 +++++++++++++++++++ weblate/lang/models.py | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 weblate/lang/migrations/0009_auto_20180129_1434.py diff --git a/weblate/lang/data.py b/weblate/lang/data.py index 387a2068f768..df9b109d80b5 100644 --- a/weblate/lang/data.py +++ b/weblate/lang/data.py @@ -213,10 +213,13 @@ ' || n % 100 == 40 || n % 100 == 60 || n % 100 == 80) ? 2 : 3))', '(n % 100 == 1) ? 0 : ((n % 100 == 2) ? 1 : ((n % 100 == 3 || n % 100 == 4) ? 2 : 3))', '(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && n % 10 == 0) ? 2 : 3))', - '(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)', '(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3', ) +OTHER_ONE_TWO_FEW_PLURALS = ( + '(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)', +) + ONE_TWO_FEW_MANY_OTHER_PLURALS = ( 'n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4', 'n==1 ? 0 : n==2 ? 1 : (n>2 && n<7) ? 2 :(n>6 && n<11) ? 3 : 4', @@ -253,6 +256,7 @@ PLURAL_ONE_TWO_FEW_MANY_OTHER = 10 PLURAL_ZERO_ONE_OTHER = 11 PLURAL_ZERO_ONE_TWO_THREE_SIX_OTHER = 12 +PLURAL_OTHER_ONE_TWO_FEW = 13 PLURAL_UNKNOWN = 666 # Plural equation - type mappings @@ -262,6 +266,7 @@ (ONE_TWO_OTHER_PLURALS, PLURAL_ONE_TWO_OTHER), (ZERO_ONE_OTHER_PLURALS, PLURAL_ZERO_ONE_OTHER), (ONE_TWO_FEW_OTHER_PLURALS, PLURAL_ONE_TWO_FEW_OTHER), + (OTHER_ONE_TWO_FEW_PLURALS, PLURAL_OTHER_ONE_TWO_FEW), (ONE_TWO_THREE_OTHER_PLURALS, PLURAL_ONE_TWO_THREE_OTHER), (ONE_OTHER_ZERO_PLURALS, PLURAL_ONE_OTHER_ZERO), (ONE_FEW_MANY_OTHER_PLURALS, PLURAL_ONE_FEW_MANY_OTHER), @@ -312,6 +317,12 @@ pgettext_lazy('Plural form description', 'Few'), pgettext_lazy('Plural form description', 'Other'), ), + PLURAL_OTHER_ONE_TWO_FEW: ( + pgettext_lazy('Plural form description', 'Other'), + pgettext_lazy('Plural form description', 'One'), + pgettext_lazy('Plural form description', 'Two'), + pgettext_lazy('Plural form description', 'Few'), + ), PLURAL_ONE_OTHER_ZERO: ( pgettext_lazy('Plural form description', 'One'), pgettext_lazy('Plural form description', 'Other'), diff --git a/weblate/lang/migrations/0009_auto_20180129_1434.py b/weblate/lang/migrations/0009_auto_20180129_1434.py new file mode 100644 index 000000000000..d3342c080ce5 --- /dev/null +++ b/weblate/lang/migrations/0009_auto_20180129_1434.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.9 on 2018-01-29 13:34 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('lang', '0008_auto_20180129_1350'), + ] + + operations = [ + migrations.AlterField( + model_name='plural', + name='type', + field=models.IntegerField(choices=[(0, 'None'), (1, 'One/other (classic plural)'), (2, 'One/few/other (Slavic languages)'), (3, 'Arabic languages'), (11, 'Zero/one/other'), (4, 'One/two/other'), (6, 'One/two/few/other'), (13, 'Other/one/two/few'), (5, 'One/two/three/other'), (7, 'One/other/zero'), (8, 'One/few/many/other'), (9, 'Two/other'), (10, 'One/two/few/many/other'), (666, 'Unknown')], default=1, editable=False, verbose_name='Plural type'), + ), + ] diff --git a/weblate/lang/models.py b/weblate/lang/models.py index e4eceb396a79..4f6421447e6a 100644 --- a/weblate/lang/models.py +++ b/weblate/lang/models.py @@ -566,6 +566,10 @@ class Plural(models.Model): data.PLURAL_ONE_TWO_FEW_OTHER, pgettext_lazy('Plural type', 'One/two/few/other') ), + ( + data.PLURAL_OTHER_ONE_TWO_FEW, + pgettext_lazy('Plural type', 'Other/one/two/few') + ), ( data.PLURAL_ONE_TWO_THREE_OTHER, pgettext_lazy('Plural type', 'One/two/three/other')