forked from mozilla/pontoon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix lt plural rule broken in the initial data migration (mozilla#2993)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
), | ||
] |