changeset 318:863b81f04259 stable-0.9.x

Ported [335:338], [345], and [351] to 0.9.x stable branch.
author cmlenz
date Fri, 01 Feb 2008 15:41:31 +0000
parents c976934be834
children eb7894f3323f
files ChangeLog babel/messages/frontend.py babel/messages/plurals.py
diffstat 3 files changed, 65 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,14 @@
 (?, from branches/stable/0.9.x)
 
  * Fixed catalogs' charset values not being recognized (ticket #66).
+ * Numerous improvements to the default plural forms.
  * Fixed fuzzy matching when updating message catalogs (ticket #82).
  * Fixed bug in catalog updating, that in some cases pulled in translations
    from different catalogs based on the same template.
  * Location lines in PO files do no longer get wrapped at hyphens in file
    names (ticket #79).
+ * Fixed division by zero error in catalog compilation on empty catalogs
+   (ticket #60).
 
 
 Version 0.9.1
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -147,9 +147,11 @@
                 for message in list(catalog)[1:]:
                     if message.string:
                         translated +=1
+                percentage = 0
+                if len(catalog):
+                    percentage = translated * 100 // len(catalog)
                 log.info('%d of %d messages (%d%%) translated in %r',
-                         translated, len(catalog),
-                         translated * 100 // len(catalog), po_file)
+                         translated, len(catalog), percentage, po_file)
 
             if catalog.fuzzy and not self.use_fuzzy:
                 log.warn('catalog %r is marked as fuzzy, skipping', po_file)
@@ -738,9 +740,11 @@
                 for message in list(catalog)[1:]:
                     if message.string:
                         translated +=1
+                percentage = 0
+                if len(catalog):
+                    percentage = translated * 100 // len(catalog)
                 self.log.info("%d of %d messages (%d%%) translated in %r",
-                              translated, len(catalog),
-                              translated * 100 // len(catalog), po_file)
+                              translated, len(catalog), percentage, po_file)
 
             if catalog.fuzzy and not options.use_fuzzy:
                 self.log.warn('catalog %r is marked as fuzzy, skipping',
--- a/babel/messages/plurals.py
+++ b/babel/messages/plurals.py
@@ -14,24 +14,76 @@
 """Plural form definitions."""
 
 PLURALS = {
+    # Afar
+    # 'aa': (),
+    # Abkhazian
+    # 'ab': (),
+    # Avestan
+    # 'ae': (),
     # Afrikaans - From Pootle's PO's
     'af': (2, '(n != 1)'),
+    # Akan
+    # 'ak': (),
+    # Amharic
+    # 'am': (),
+    # Aragonese
+    # 'an': (),
     # Arabic - From Pootle's PO's
     'ar': (6, '(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n>=3 && n<=10 ? 3 : n>=11 && n<=99 ? 4 : 5)'),
+    # Assamese
+    # 'as': (),
+    # Avaric
+    # 'av': (),
+    # Aymara
+    # 'ay': (),
+    # Azerbaijani
+    # 'az': (),
+    # Bashkir
+    # 'ba': (),
+    # Belarusian
+    # 'be': (),
     # Bulgarian - From Pootle's PO's
     'bg': (2, '(n != 1)'),
+    # Bihari
+    # 'bh': (),
+    # Bislama
+    # 'bi': (),
+    # Bambara
+    # 'bm': (),
     # Bengali - From Pootle's PO's
     'bn': (2, '(n != 1)'),
     # Tibetan - as discussed in private with Andrew West
     'bo': (1, '0'),
+    # Breton
+    # 'br': (),
+    # Bosnian
+    # 'bs': (),
     # Catalan - From Pootle's PO's
     'ca': (2, '(n != 1)'),
+    # Chechen
+    # 'ce': (),
+    # Chamorro
+    # 'ch': (),
+    # Corsican
+    # 'co': (),
+    # Cree
+    # 'cr': (),
     # Czech
     'cs': (3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)'),
+    # Church Slavic
+    # 'cu': (),
+    # Chuvash
+    'cv': (1, '0'),
+    # Welsh
+    'cy': (5, 'n==1 ? 1 : n==2 ? 2 : n==3 ? 3 : n==6 ? 4 : 0'),
     # Danish
     'da': (2, '(n != 1)'),
     # German
     'de': (2, '(n != 1)'),
+    # Divehi
+    # 'dv': (),
+    # Dzongkha
+    'dz': (1, '0'),
     # Greek
     'el': (2, '(n != 1)'),
     # English
@@ -84,6 +136,8 @@
     'ko': (1, '0'),
     # Kurdish - From Pootle's PO's
     'ku': (2, '(n != 1)'),
+    # Lao - Another member of the Tai language family, like Thai.
+    'lo': (1, '0'),
     # Lithuanian
     'lt': (3, '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)'),
     # Latvian
Copyright (C) 2012-2017 Edgewall Software