Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[soc2009/i18n] added script to import locales from cldr, and formats …

…for existing locales

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/i18n-improvements@11377 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9dfe9f072bfac9f7716ff3a4eebe6171bc75b305 1 parent c52ae07
Marc garcia-marc authored
Showing with 936 additions and 21 deletions.
  1. 0  django/conf/locale/ar/__init__.py
  2. +14 −0 django/conf/locale/ar/formats.py
  3. 0  django/conf/locale/bg/__init__.py
  4. +14 −0 django/conf/locale/bg/formats.py
  5. 0  django/conf/locale/bn/__init__.py
  6. +14 −0 django/conf/locale/bn/formats.py
  7. +6 −10 django/conf/locale/ca/formats.py
  8. 0  django/conf/locale/cs/__init__.py
  9. +14 −0 django/conf/locale/cs/formats.py
  10. 0  django/conf/locale/cy/__init__.py
  11. +14 −0 django/conf/locale/cy/formats.py
  12. 0  django/conf/locale/da/__init__.py
  13. +14 −0 django/conf/locale/da/formats.py
  14. 0  django/conf/locale/de/__init__.py
  15. +14 −0 django/conf/locale/de/formats.py
  16. 0  django/conf/locale/el/__init__.py
  17. +14 −0 django/conf/locale/el/formats.py
  18. +7 −11 django/conf/locale/en/formats.py
  19. 0  django/conf/locale/es/__init__.py
  20. +14 −0 django/conf/locale/es/formats.py
  21. 0  django/conf/locale/es_AR/__init__.py
  22. +14 −0 django/conf/locale/es_AR/formats.py
  23. 0  django/conf/locale/et/__init__.py
  24. +14 −0 django/conf/locale/et/formats.py
  25. 0  django/conf/locale/eu/__init__.py
  26. +14 −0 django/conf/locale/eu/formats.py
  27. 0  django/conf/locale/fa/__init__.py
  28. +14 −0 django/conf/locale/fa/formats.py
  29. 0  django/conf/locale/fi/__init__.py
  30. +14 −0 django/conf/locale/fi/formats.py
  31. 0  django/conf/locale/fr/__init__.py
  32. +14 −0 django/conf/locale/fr/formats.py
  33. 0  django/conf/locale/ga/__init__.py
  34. +14 −0 django/conf/locale/ga/formats.py
  35. 0  django/conf/locale/gl/__init__.py
  36. +14 −0 django/conf/locale/gl/formats.py
  37. 0  django/conf/locale/he/__init__.py
  38. +14 −0 django/conf/locale/he/formats.py
  39. 0  django/conf/locale/hi/__init__.py
  40. +14 −0 django/conf/locale/hi/formats.py
  41. 0  django/conf/locale/hr/__init__.py
  42. +14 −0 django/conf/locale/hr/formats.py
  43. 0  django/conf/locale/hu/__init__.py
  44. +14 −0 django/conf/locale/hu/formats.py
  45. 0  django/conf/locale/is/__init__.py
  46. +14 −0 django/conf/locale/is/formats.py
  47. 0  django/conf/locale/it/__init__.py
  48. +14 −0 django/conf/locale/it/formats.py
  49. 0  django/conf/locale/ja/__init__.py
  50. +14 −0 django/conf/locale/ja/formats.py
  51. 0  django/conf/locale/ka/__init__.py
  52. +14 −0 django/conf/locale/ka/formats.py
  53. 0  django/conf/locale/km/__init__.py
  54. +14 −0 django/conf/locale/km/formats.py
  55. 0  django/conf/locale/kn/__init__.py
  56. +14 −0 django/conf/locale/kn/formats.py
  57. 0  django/conf/locale/ko/__init__.py
  58. +14 −0 django/conf/locale/ko/formats.py
  59. 0  django/conf/locale/lt/__init__.py
  60. +14 −0 django/conf/locale/lt/formats.py
  61. 0  django/conf/locale/lv/__init__.py
  62. +14 −0 django/conf/locale/lv/formats.py
  63. 0  django/conf/locale/mk/__init__.py
  64. +14 −0 django/conf/locale/mk/formats.py
  65. 0  django/conf/locale/nl/__init__.py
  66. +14 −0 django/conf/locale/nl/formats.py
  67. 0  django/conf/locale/no/__init__.py
  68. +14 −0 django/conf/locale/no/formats.py
  69. 0  django/conf/locale/pl/__init__.py
  70. +14 −0 django/conf/locale/pl/formats.py
  71. 0  django/conf/locale/pt/__init__.py
  72. +14 −0 django/conf/locale/pt/formats.py
  73. 0  django/conf/locale/pt_BR/__init__.py
  74. +14 −0 django/conf/locale/pt_BR/formats.py
  75. 0  django/conf/locale/ro/__init__.py
  76. +14 −0 django/conf/locale/ro/formats.py
  77. 0  django/conf/locale/ru/__init__.py
  78. +14 −0 django/conf/locale/ru/formats.py
  79. 0  django/conf/locale/sk/__init__.py
  80. +14 −0 django/conf/locale/sk/formats.py
  81. 0  django/conf/locale/sl/__init__.py
  82. +14 −0 django/conf/locale/sl/formats.py
  83. 0  django/conf/locale/sr/__init__.py
  84. +14 −0 django/conf/locale/sr/formats.py
  85. 0  django/conf/locale/sv/__init__.py
  86. +14 −0 django/conf/locale/sv/formats.py
  87. 0  django/conf/locale/ta/__init__.py
  88. +14 −0 django/conf/locale/ta/formats.py
  89. 0  django/conf/locale/te/__init__.py
  90. +14 −0 django/conf/locale/te/formats.py
  91. 0  django/conf/locale/th/__init__.py
  92. +14 −0 django/conf/locale/th/formats.py
  93. 0  django/conf/locale/tr/__init__.py
  94. +14 −0 django/conf/locale/tr/formats.py
  95. 0  django/conf/locale/uk/__init__.py
  96. +14 −0 django/conf/locale/uk/formats.py
  97. 0  django/conf/locale/zh_CN/__init__.py
  98. +14 −0 django/conf/locale/zh_CN/formats.py
  99. 0  django/conf/locale/zh_TW/__init__.py
  100. +14 −0 django/conf/locale/zh_TW/formats.py
  101. +237 −0 django/core/management/commands/importcldr.py
0  django/conf/locale/ar/__init__.py
View
No changes.
14 django/conf/locale/ar/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F، Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd‏/m‏/Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/bg/__init__.py
View
No changes.
14 django/conf/locale/bg/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/bn/__init__.py
View
No changes.
14 django/conf/locale/bn/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F, Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
16 django/conf/locale/ca/formats.py
View
@@ -2,17 +2,13 @@
#
DATE_FORMAT = 'j \de F \de Y'
-DATETIME_FORMAT = 'j \de F \de Y \\a \le\s H:i'
-TIME_FORMAT = 'H:i'
-YEAR_MONTH_FORMAT = 'F \de Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F \de\l Y'
MONTH_DAY_FORMAT = 'j \de F'
-
SHORT_DATE_FORMAT = 'd/m/Y'
-SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
-
-FIRST_DAY_OF_WEEK = 1 # 0 means Sunday
-
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
-NUMBER_GROUPING = 3
-
+# NUMBER_GROUPING =
0  django/conf/locale/cs/__init__.py
View
No changes.
14 django/conf/locale/cs/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/cy/__init__.py
View
No changes.
14 django/conf/locale/cy/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/da/__init__.py
View
No changes.
14 django/conf/locale/da/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. M Y'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/de/__init__.py
View
No changes.
14 django/conf/locale/de/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j. F Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/el/__init__.py
View
No changes.
14 django/conf/locale/el/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
18 django/conf/locale/en/formats.py
View
@@ -1,18 +1,14 @@
# This file is distributed under the same license as the Django package.
#
-DATE_FORMAT = 'N j, Y'
-DATETIME_FORMAT = 'N j, Y, P'
-TIME_FORMAT = 'P'
+DATE_FORMAT = 'F j, Y'
+TIME_FORMAT = 'g:i:s A'
+DATETIME_FORMAT = 'F j, Y g:i:s A'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j'
-
-SHORT_DATE_FORMAT = 'm/d/Y'
-SHORT_DATETIME_FORMAT = 'm/d/Y h:i A'
-
-FIRST_DAY_OF_WEEK = 0 # 0 means Sunday
-
+SHORT_DATE_FORMAT = 'M j, Y'
+SHORT_DATETIME_FORMAT = 'M j, Y g:i:s A'
+# FIRST_DAY_OF_WEEK =
DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ','
-
-
+# NUMBER_GROUPING =
0  django/conf/locale/es/__init__.py
View
No changes.
14 django/conf/locale/es/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \de F \de Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F \de Y'
+MONTH_DAY_FORMAT = 'j \de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/es_AR/__init__.py
View
No changes.
14 django/conf/locale/es_AR/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT =
+# TIME_FORMAT =
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+# SHORT_DATE_FORMAT =
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/et/__init__.py
View
No changes.
14 django/conf/locale/et/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/eu/__init__.py
View
No changes.
14 django/conf/locale/eu/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Yeko M\re\n d\a'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+SHORT_DATE_FORMAT = 'Y M j'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/fa/__init__.py
View
No changes.
14 django/conf/locale/fa/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j F Y، ساعت G:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'Y/n/j'
+SHORT_DATETIME_FORMAT = 'Y/n/j،‏ G:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/fi/__init__.py
View
No changes.
14 django/conf/locale/fi/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G.i.s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/fr/__init__.py
View
No changes.
14 django/conf/locale/fr/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j F Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y H:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/ga/__init__.py
View
No changes.
14 django/conf/locale/ga/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/gl/__init__.py
View
No changes.
14 django/conf/locale/gl/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/he/__init__.py
View
No changes.
14 django/conf/locale/he/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j בF Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j בF Y H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j בF'
+SHORT_DATE_FORMAT = 'd/m/Y'
+SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/hi/__init__.py
View
No changes.
14 django/conf/locale/hi/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd-m-Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/hr/__init__.py
View
No changes.
14 django/conf/locale/hr/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y.'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y.'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/hu/__init__.py
View
No changes.
14 django/conf/locale/hu/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y. F j.'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'F j.'
+SHORT_DATE_FORMAT = 'Y.m.d.'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/is/__init__.py
View
No changes.
14 django/conf/locale/is/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/it/__init__.py
View
No changes.
14 django/conf/locale/it/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd/M/Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/ja/__init__.py
View
No changes.
14 django/conf/locale/ja/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y年n月j日'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'Y年n月j日G:i:s'
+YEAR_MONTH_FORMAT = 'Y年n月'
+MONTH_DAY_FORMAT = 'n月j日'
+SHORT_DATE_FORMAT = 'Y/m/d'
+SHORT_DATETIME_FORMAT = 'Y/m/d G:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/ka/__init__.py
View
No changes.
14 django/conf/locale/ka/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y F j'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+SHORT_DATE_FORMAT = 'Y M j'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/km/__init__.py
View
No changes.
14 django/conf/locale/km/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j ខែ F ឆ្នាំ Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j ខែ F ឆ្នាំ Y, G:i:s'
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/kn/__init__.py
View
No changes.
14 django/conf/locale/kn/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'h:i:s A'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/ko/__init__.py
View
No changes.
14 django/conf/locale/ko/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y년 n월 j일'
+TIME_FORMAT = 'A g:i:s'
+DATETIME_FORMAT = 'Y년 n월 j일A g:i:s'
+YEAR_MONTH_FORMAT = 'Y년 F'
+MONTH_DAY_FORMAT = 'F j일'
+SHORT_DATE_FORMAT = 'Y. n. j.'
+SHORT_DATETIME_FORMAT = 'Y. n. j. A g:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/lt/__init__.py
View
No changes.
14 django/conf/locale/lt/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y \m. F j \d.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+SHORT_DATE_FORMAT = 'Y.m.d'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/lv/__init__.py
View
No changes.
14 django/conf/locale/lv/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'Y. \g\a\d\a j. F'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'Y. \g. F'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'Y. \g\a\d\a j. M'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/mk/__init__.py
View
No changes.
14 django/conf/locale/mk/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+SHORT_DATE_FORMAT = 'd.n.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/nl/__init__.py
View
No changes.
14 django/conf/locale/nl/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/no/__init__.py
View
No changes.
14 django/conf/locale/no/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT =
+# TIME_FORMAT =
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+# SHORT_DATE_FORMAT =
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/pl/__init__.py
View
No changes.
14 django/conf/locale/pl/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd-m-Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/pt/__init__.py
View
No changes.
14 django/conf/locale/pt/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j \de F \de Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F \de Y'
+MONTH_DAY_FORMAT = 'j \de F'
+SHORT_DATE_FORMAT = 'd/m/Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/pt_BR/__init__.py
View
No changes.
14 django/conf/locale/pt_BR/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT =
+# TIME_FORMAT =
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+# SHORT_DATE_FORMAT =
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/ro/__init__.py
View
No changes.
14 django/conf/locale/ro/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H:i:s'
+DATETIME_FORMAT = 'j F Y, H:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+SHORT_DATETIME_FORMAT = 'd.m.Y, H:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/ru/__init__.py
View
No changes.
14 django/conf/locale/ru/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y г.'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'd.m.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/sk/__init__.py
View
No changes.
14 django/conf/locale/sk/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j. F Y'
+TIME_FORMAT = 'G:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j.n.Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/sl/__init__.py
View
No changes.
14 django/conf/locale/sl/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd. F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j. F'
+SHORT_DATE_FORMAT = 'j. M. Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/sr/__init__.py
View
No changes.
14 django/conf/locale/sr/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd. F Y.'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'Y F'
+MONTH_DAY_FORMAT = 'F j.'
+SHORT_DATE_FORMAT = 'd.m.Y.'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/sv/__init__.py
View
No changes.
14 django/conf/locale/sv/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'H.i.s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'Y F'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/ta/__init__.py
View
No changes.
14 django/conf/locale/ta/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F, Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M, Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/te/__init__.py
View
No changes.
14 django/conf/locale/te/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'g:i:s A'
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/th/__init__.py
View
No changes.
14 django/conf/locale/th/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y'
+TIME_FORMAT = 'G:i:s'
+DATETIME_FORMAT = 'j F Y, G:i:s'
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+SHORT_DATETIME_FORMAT = 'j M Y, G:i:s'
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
+# NUMBER_GROUPING =
0  django/conf/locale/tr/__init__.py
View
No changes.
14 django/conf/locale/tr/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'd F Y'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'd F'
+SHORT_DATE_FORMAT = 'd M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = '.'
+# NUMBER_GROUPING =
0  django/conf/locale/uk/__init__.py
View
No changes.
14 django/conf/locale/uk/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+DATE_FORMAT = 'j F Y р.'
+TIME_FORMAT = 'H:i:s'
+# DATETIME_FORMAT =
+YEAR_MONTH_FORMAT = 'F Y'
+MONTH_DAY_FORMAT = 'j F'
+SHORT_DATE_FORMAT = 'j M Y'
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+DECIMAL_SEPARATOR = ','
+THOUSAND_SEPARATOR = ' '
+# NUMBER_GROUPING =
0  django/conf/locale/zh_CN/__init__.py
View
No changes.
14 django/conf/locale/zh_CN/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT =
+# TIME_FORMAT =
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+# SHORT_DATE_FORMAT =
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
0  django/conf/locale/zh_TW/__init__.py
View
No changes.
14 django/conf/locale/zh_TW/formats.py
View
@@ -0,0 +1,14 @@
+# This file is distributed under the same license as the Django package.
+#
+
+# DATE_FORMAT =
+# TIME_FORMAT =
+# DATETIME_FORMAT =
+# YEAR_MONTH_FORMAT =
+# MONTH_DAY_FORMAT =
+# SHORT_DATE_FORMAT =
+# SHORT_DATETIME_FORMAT =
+# FIRST_DAY_OF_WEEK =
+# DECIMAL_SEPARATOR =
+# THOUSAND_SEPARATOR =
+# NUMBER_GROUPING =
237 django/core/management/commands/importcldr.py
View
@@ -0,0 +1,237 @@
+import sys
+import os
+import re
+from optparse import make_option, OptionParser
+
+from django.core.management.base import LabelCommand, CommandError
+
+try:
+ from lxml import etree
+except ImportError:
+ raise CommandError('You need to install `python-lxml` to run this script')
+
+FORMATS_FILE_NAME = 'formats.py'
+FORMATS_FILE_HEADER = '''# This file is distributed under the same license as the Django package.
+#
+
+'''
+
+def quote(nodes, name, locale, previous):
+ if len(nodes):
+ return "'%s'" % unicode(nodes[0].text).replace("'", "\\'")
+ else:
+ return None
+
+def convert_time(nodes, name, locale, previous):
+ SPECIAL_CHARS = ('a', 'A', 'b', 'B', 'd', 'D', 'f', 'F', 'g', 'G', 'h',
+ 'H', 'i', 'I', 'j', 'l', 'L', 'm', 'M', 'n', 'N', 'O', 'P', 'r',
+ 's', 'S', 't', 'T', 'U', 'w', 'W', 'y', 'Y', 'z', 'Z')
+ FORMAT_STR_MAP = ( # not using a dict, because we have to apply formats in order
+ ('dd', 'd'),
+ ('d', 'j'),
+ ('MMMM', 'F'),
+ ('MMM', 'M'),
+ ('MM', 'm'),
+ ('M', 'n'),
+ ('yyyy', 'Y'),
+ ('yy', 'y'),
+ ('y', 'Y'),
+ ('hh', 'h'),
+ ('h', 'g'),
+ ('HH', 'H'),
+ ('H', 'G'),
+ ('mm', 'i'),
+ ('ss', 's'),
+ ('a', 'A'),
+ ('LLLL', 'F'),
+ )
+ if len(nodes):
+ original = nodes[0].text
+ result = ''
+ for cnt, segment in enumerate(original.split("'")):
+ if cnt % 2:
+ for char in SPECIAL_CHARS:
+ segment = segment.replace(char, '\\%s' % char)
+ result += segment
+ else:
+ while segment:
+ found = False
+ for src, dst in FORMAT_STR_MAP:
+ if segment[0:len(src)] == src:
+ result += dst
+ segment = segment[len(src):]
+ found = True
+ break
+ if not found:
+ result += segment[0]
+ segment = segment[1:]
+
+ return "'%s'" % result
+ else:
+ return None
+
+def datetime(nodes, name, locale, previous):
+ result = None
+ if len(nodes) and 'DATE_FORMAT' in previous and 'TIME_FORMAT' in previous:
+ result = nodes[0].text
+ result = result.replace('{0}', previous['TIME_FORMAT'][1:-1])
+ if name == 'SHORT_DATETIME_FORMAT' and 'SHORT_DATE_FORMAT' in previous:
+ result = result.replace('{1}', previous['SHORT_DATE_FORMAT'][1:-1])
+ else:
+ result = result.replace('{1}', previous['DATE_FORMAT'][1:-1])
+ if result:
+ return "'%s'" % result
+ else:
+ return None
+
+def first_day(nodes, name, locale, previous):
+ DAY_MAP = {
+ 'sun': '0',
+ 'mon': '1',
+ 'tue': '2',
+ 'wed': '3',
+ 'thu': '4',
+ 'fri': '5',
+ 'sat': '6',
+ }
+ for node in nodes:
+ territories = node.attrib['territories']
+ day = node.attrib['day']
+ if territories == '001':
+ result = day
+ if locale.upper() in territories.split():
+ result = day
+ break
+ return DAY_MAP.get(result)
+
+FORMATS_MAP = [
+ {
+ 'name': 'DATE_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='long']/dateFormat/pattern",
+ 'conversion': convert_time,
+ },
+ {
+ 'name': 'TIME_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/timeFormats/timeFormatLength[@type='medium']/timeFormat/pattern",
+ 'conversion': convert_time,
+ },
+ {
+ 'name': 'DATETIME_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='long']/dateTimeFormat/pattern",
+ 'conversion': datetime,
+ },
+ {
+ 'name': 'YEAR_MONTH_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='yMMMM']",
+ 'conversion': convert_time,
+ },
+ {
+ 'name': 'MONTH_DAY_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/availableFormats/dateFormatItem[@id='MMMMd']",
+ 'conversion': convert_time,
+ },
+ {
+ 'name': 'SHORT_DATE_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateFormats/dateFormatLength[@type='medium']/dateFormat/pattern",
+ 'conversion': convert_time,
+ },
+ {
+ 'name': 'SHORT_DATETIME_FORMAT',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/dates/calendars/calendar[@type='gregorian']/dateTimeFormats/dateTimeFormatLength[@type='short']/dateTimeFormat/pattern",
+ 'conversion': datetime,
+ },
+ {'name': 'FIRST_DAY_OF_WEEK'},
+ {
+ 'name': 'DECIMAL_SEPARATOR',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/numbers/symbols/decimal",
+ 'conversion': quote,
+ },
+ {
+ 'name': 'THOUSAND_SEPARATOR',
+ 'file': os.path.join('common', 'main', '%(locale)s.xml'),
+ 'pattern': "/ldml/numbers/symbols/group",
+ 'conversion': quote,
+ },
+ {'name': 'NUMBER_GROUPING'},
+]
+"""
+"""
+
+def get_locales(django_locale_dir, locale=None):
+ if locale:
+ yield locale
+ else:
+ locale_re = re.compile('[a-z]{2}(_[A-Z]{2})?')
+ for locale in os.listdir(django_locale_dir):
+ if locale_re.match(locale):
+ yield locale
+
+def import_cldr(cldr_dir, locale=None, overwrite=False):
+ """
+ For every locale defined in Django, get from the CLDR locale file all
+ settings defined in output_structure, and write the result to the
+ locale directories on Django.
+ """
+ if not os.path.isdir(cldr_dir):
+ raise Exception, "Specified CLDR directory '%s' does not exist" % cldr_dir
+
+ import django
+ django_locale_dir = os.path.join(os.path.dirname(django.__file__), 'conf', 'locale')
+
+ for locale in get_locales(django_locale_dir, locale):
+ output_filename = os.path.join(django_locale_dir, locale, FORMATS_FILE_NAME)
+ if os.path.isfile(output_filename) and not overwrite:
+ print "'%s' locale already exists. Skipping" % locale
+ else:
+ result = {}
+ output_file = open(output_filename, 'w')
+ output_file.write(FORMATS_FILE_HEADER)
+ for format in FORMATS_MAP:
+ if 'file' in format:
+ cldr_file = os.path.join(cldr_dir, format['file'] % dict(locale=locale))
+ tree = etree.parse(cldr_file) # TODO: error control
+ try:
+ original_value = tree.xpath(format['pattern'])
+ except IndexError:
+ output_file.write('# %s = \n' % (format['name']))
+ else:
+ value = format['conversion'](original_value, format['name'], locale, result)
+ if value:
+ output_file.write('%s = %s\n' % (format['name'], value.encode('utf8')))
+ result[format['name']] = value
+ else:
+ output_file.write('# %s = \n' % (format['name']))
+ else:
+ output_file.write('# %s = \n' % (format['name']))
+ output_file.close()
+
+ init_filename = os.path.join(django_locale_dir, locale, '__init__.py')
+ open(init_filename, 'a').close()
+
+class Command(LabelCommand):
+ option_list = LabelCommand.option_list + (
+ make_option('--locale', '-l', dest='locale',
+ help='The locale to process. Default is to process all.'),
+ ) + (
+ make_option('--overwite', '-o', action='store_true', dest='overwrite',
+ help='Wheter to overwrite format definitions of locales that already have one.'),
+ )
+ help = 'Creates format definition files for locales, importing data from the CLDR.'
+ args = '[cldrpath]'
+ label = 'CLDR path'
+ requires_model_validation = False
+ can_import_settings = False
+
+ def handle_label(self, cldrpath, **options):
+ locale = options.get('locale')
+ overwrite = options.get('overwrite')
+ import_cldr(cldrpath, locale, overwrite)
+
Please sign in to comment.
Something went wrong with that request. Please try again.