Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

migrations: Update user and realm preferences of zh_Hant to zh_TW.

Alex Vandiver2250ae3f0d82
diff --git a/zerver/migrations/0639_zh_hant_tw_rename.py b/zerver/migrations/0639_zh_hant_tw_rename.py
new file mode 100644
index 00000000000..c9cc4c83482
--- /dev/null
+++ b/zerver/migrations/0639_zh_hant_tw_rename.py
@@ -0,0 +1,30 @@
+# Generated by Django 5.0.9 on 2024-12-10 15:49
+
+from django.db import migrations
+from django.db.backends.base.schema import BaseDatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+def update_zh_hant_tw_language(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
+ UserProfile = apps.get_model("zerver", "UserProfile")
+ UserProfile.objects.filter(default_language="zh-hant").update(default_language="zh-tw")
+
+ PreregistrationRealm = apps.get_model("zerver", "PreregistrationRealm")
+ PreregistrationRealm.objects.filter(default_language="zh-hant").update(default_language="zh-tw")
+
+ Realm = apps.get_model("zerver", "Realm")
+ Realm.objects.filter(default_language="zh-hant").update(default_language="zh-tw")
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zerver", "0638_alter_stream_can_administer_channel_group"),
+ ]
+
+ operations = [
+ migrations.RunPython(
+ update_zh_hant_tw_language,
+ elidable=True,
+ reverse_code=migrations.RunPython.noop,
+ )
+ ]