From d970e82235904e4f8843f1f0f42c0dcc9b39995d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matja=C5=BE=20Horvat?= Date: Tue, 17 Oct 2023 11:18:07 +0200 Subject: [PATCH] Fix lt plural rule broken in the initial data migration (#2993) --- .../migrations/0047_fix_lt_plural_rule.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pontoon/base/migrations/0047_fix_lt_plural_rule.py diff --git a/pontoon/base/migrations/0047_fix_lt_plural_rule.py b/pontoon/base/migrations/0047_fix_lt_plural_rule.py new file mode 100644 index 0000000000..c4d832fb37 --- /dev/null +++ b/pontoon/base/migrations/0047_fix_lt_plural_rule.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.15 on 2023-10-17 07:09 + +from django.db import migrations + + +def fix_lt_plural_rule(apps, schema_editor): + Locale = apps.get_model("base", "Locale") + locale = Locale.objects.get(code="lt") + locale.plural_rule = ( + "(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)" + ) + locale.save(update_fields=["plural_rule"]) + + +class Migration(migrations.Migration): + + dependencies = [ + ("base", "0046_projectslughistory"), + ] + + operations = [ + migrations.RunPython( + code=fix_lt_plural_rule, + reverse_code=migrations.RunPython.noop, + ), + ]