[damned-lies] Refs #216 - Map Chinese lang codes to Django convention
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Refs #216 - Map Chinese lang codes to Django convention
- Date: Wed, 17 Mar 2021 17:44:24 +0000 (UTC)
commit f6f53562e251806f90fbdd768c1b7337571aa8d3
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Mar 17 18:43:05 2021 +0100
Refs #216 - Map Chinese lang codes to Django convention
stats/management/commands/compile-trans.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/stats/management/commands/compile-trans.py b/stats/management/commands/compile-trans.py
index 7f809a81..f737c006 100644
--- a/stats/management/commands/compile-trans.py
+++ b/stats/management/commands/compile-trans.py
@@ -8,6 +8,10 @@ from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Compile translations of djamnedlies"
+ lang_mapping = {
+ 'zh_CN': 'zh_Hans',
+ 'zh_TW': 'zh_Hant',
+ }
def handle(self, **options):
# Copy all po/ll.po files in locale/ll/LC_MESSAGES/django.po
@@ -16,7 +20,9 @@ class Command(BaseCommand):
if pofile[-3:] != ".po":
continue
lang_code = pofile[:-3]
- localedir = os.path.join(settings.BASE_DIR, 'locale', lang_code, 'LC_MESSAGES')
+ localedir = os.path.join(
+ settings.BASE_DIR, 'locale', self.lang_mapping.get(lang_code, lang_code), 'LC_MESSAGES'
+ )
if not os.path.isdir(localedir):
os.makedirs(localedir)
shutil.copy(os.path.join(podir, pofile), os.path.join(localedir, 'django.po'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]