Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Keep the [zero] case as a separate unit.

This allows all languages to translate it specifically, not
just languages with a rule specifically for [zero].
  • Loading branch information...
commit 00926f2f1a2d122bad533433a576ef240dcc9761 1 parent 9f9f1ff
@friedelwolff friedelwolff authored
View
3  translate/convert/po2prop.py
@@ -73,6 +73,9 @@ def _explode_gaia_plurals(self):
for category, text in zip(names, unit.target.strings):
# TODO: for now we assume all forms are present. We need to
# fill in the rest after mapping things to the proper CLDR names.
+ if category == 'zero':
+ # [zero] cases are translated as separate units
+ continue
new_unit = self.inputstore.addsourceunit(u"fish") # not used
new_location = '%s[%s]' % (location, category)
new_unit.addlocation(new_location)
View
4 translate/convert/prop2po.py
@@ -159,7 +159,9 @@ def fold_gaia_plurals(self, postore):
location = unit.getlocations()[0]
if current_plural and location.startswith(current_plural):
plurals[current_plural].append(unit)
- continue
+ if not '[zero]' in location:
+ # We want to keep [zero] cases separately translatable
+ continue
elif current_plural:
# End of a set of plural units
new_unit = _collapse(new_store, plurals[current_plural])
View
10 translate/convert/test_po2prop.py
@@ -190,10 +190,16 @@ def test_gaia_plurals(self):
message-multiedit-header[many]={{ n }} selected
message-multiedit-header[other]={{ n }} selected
'''
- posource = r'''#: message-multiedit-header
+ posource = r'''#: message-multiedit-header[zero]
+msgctxt "message-multiedit-header[zero]"
+msgid "Edit"
+msgstr "Redigeer"
+
+#: message-multiedit-header
+msgctxt "message-multiedit-header"
msgid "Edit"
msgid_plural "{{ n }} selected"
-msgstr[0] "Redigeer"
+msgstr[0] "xxxRedigeerxxx"
msgstr[1] "{{ n }} gekies"
msgstr[2] "{{ n }} gekies"
msgstr[3] "{{ n }} gekies"
View
7 translate/convert/test_prop2po.py
@@ -239,10 +239,15 @@ def test_gaia_plurals(self):
inputfile = wStringIO.StringIO(propsource)
inputprop = properties.propfile(inputfile, personality="gaia")
outputpo = convertor.convertstore(inputprop, personality="gaia")
- pounit = self.singleelement(outputpo)
+ pounit = outputpo.units[-1]
assert pounit.hasplural()
assert pounit.getlocations() == [u'message-multiedit-header']
+ print outputpo
+ zero_unit = outputpo.units[-2]
+ assert not zero_unit.hasplural()
+ assert zero_unit.source == u"Edit"
+
class TestProp2POCommand(test_convert.TestConvertCommand, TestProp2PO):
"""Tests running actual prop2po commands on files"""
convertmodule = prop2po
Please sign in to comment.
Something went wrong with that request. Please try again.