Skip to content

Commit

Permalink
chore: add remaining language tags (#4149)
Browse files Browse the repository at this point in the history
  • Loading branch information
AfaqShuaib09 authored Oct 17, 2023
1 parent f9dfc61 commit 5061550
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2.22 on 2023-10-16 10:44

from django.db import migrations

LANGTAGS = (
('Arabic', 'ar'),
('French', 'fr'),
('German', 'de'),
('Portuguese', 'pt'),
('Spanish', 'es'),
)

def add_languages_tag(apps, schema_editor): # pylint: disable=unused-argument
LanguageTag = apps.get_model('ietf_language_tags', 'LanguageTag')
LanguageTagTranslation = apps.get_model('ietf_language_tags', 'LanguageTagTranslation')

for name, code in LANGTAGS:
LanguageTag.objects.update_or_create(code=code, defaults={'name': name})
LanguageTagTranslation.objects.update_or_create(
master=LanguageTag.objects.get(code=code),
language_code='en',
defaults={'name_t': name}
)

class Migration(migrations.Migration):

dependencies = [
('ietf_language_tags', '0005_add_telugu_lan_tag'),
]

operations = [
migrations.RunPython(add_languages_tag, migrations.RunPython.noop),
]

0 comments on commit 5061550

Please sign in to comment.