Bug 1024837 - Uplift Add-on SDK to Firefox r=me

This commit is contained in:
Erik Vold
2014-06-16 14:42:23 -07:00
parent 315b2bfbed
commit fa73841aac
22 changed files with 547 additions and 185 deletions

View File

@@ -25,10 +25,13 @@ UNICODE_ORG_XML_URL = "http://unicode.org/repos/cldr/trunk/common/supplemental/p
CONDITION_RE = r'n( mod \d+)? (is|in|within|(not in))( not)? ([^\s]+)'
# For a given regexp.MatchObject `g` for `CONDITION_RE`,
# returns the equivalent JS piece of code
# i.e. maps pseudo conditional language from unicode.org XML to JS code
def parseCondition(g):
"""
For a given regexp.MatchObject `g` for `CONDITION_RE`,
returns the equivalent JS piece of code
i.e. maps pseudo conditional language from unicode.org XML to JS code
"""
lvalue = "n"
if g.group(1):
lvalue = "(n %% %d)" % int(g.group(1).replace("mod ", ""))
@@ -81,7 +84,9 @@ def parseCondition(g):
return "%s(%s)" % (notPrefix, " || ".join(subCondition))
def computeRules():
# Fetch plural rules data directly from unicode.org website:
"""
Fetch plural rules data directly from unicode.org website:
"""
url = UNICODE_ORG_XML_URL
f = urllib2.urlopen(url)
doc = xml.dom.minidom.parse(f)