Permalink
Switch branches/tags
release-2018.3.2 release-2018.3.1 release-2018.3.1rc1 release-2018.3 release-2018.3rc5 release-2018.3rc4 release-2018.3rc3 release-2018.3rc2 release-2018.3rc1 release-2018.3beta4 release-2018.3beta3 release-2018.3beta2 release-2018.3beta1 release-2018.2.1 release-2018.2.1rc1 release-2018.2 release-2018.2rc3 release-2018.2rc2 release-2018.2rc1 release-2018.1.1 release-2018.1.1rc2 release-2018.1.1rc1 release-2018.1 release-2018.1rc2 release-2018.1rc1 release-2017.4 release-2017.4rc4 release-2017.4rc3 release-2017.4rc2 release-2017.4rc1 release-2017.3 release-2017.3rc1 release-2017.2 release-2017.2rc1 release-2017.1 release-2017.1rc1 release-2016.4 release-2016.4rc2 release-2016.4rc1 release-2016.3 release-2016.3rc2 release-2016.3rc1 release-2016.2.1 release-2016.2 release-2016.2rc1 release-2016.1 release-2016.1rc1 release-2015.4 release-2015.4rc1 release-2015.3 release-2015.3rc1 release-2015.2 release-2015.2rc2 release-2015.2rc1 release-2015.1 release-2015.1rc1 release-2014.4 release-2014.4rc1 release-2014.3 release-2014.3rc3 release-2014.3rc2 release-2014.3rc1 release-2014.2 release-2014.2rc1 release-2014.1 release-2014.1rc4 release-2014.1rc3 release-2014.1rc2 release-2014.1rc1 release-2013.3 release-2013.3rc4 release-2013.3rc3 release-2013.3rc2 release-2013.3rc1 release-2013.2 release-2013.2rc2 release-2013.2rc1 release-2013.1.1 release-2013.1 release-2013.1rc2 release-2013.1rc1 release-2013.1beta2 release-2013.1beta1 release-2012.3.1 release-2012.3 release-2012.3rc1 release-2012.3beta3 release-2012.3beta2 release-2012.3beta1 release-2012.2.1 release-2012.2 release-2012.2rc2 release-2012.2rc1 release-2012.2beta2 release-2012.2beta1 release-2012.1 release-2012.1rc1 release-2012.1beta2 release-2012.1beta1 release-2011.3
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (124 sloc) 3.23 KB
###
#This file is a part of the NVDA project.
#URL: http://www.nvda-project.org/
#Copyright 2018 NV Access Limited, Babbage B.V.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2.0, as published by
#the Free Software Foundation.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#This license can be found at:
#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
###
Import(
'env', 'sourceDir',
)
def createCLDRAnnotationsDict(sources, dest):
import codecs
from xml.etree import ElementTree
from collections import OrderedDict
cldrDict = OrderedDict()
for source in sources:
tree = ElementTree.parse(source)
for element in tree.iter("annotation"):
if element.attrib.get("type") == "tts":
cldrDict[element.attrib['cp']] = element.text.replace(":","")
assert cldrDict, "cldrDict is empty"
with codecs.open(dest, "w", "utf_8_sig", errors="replace") as dictFile:
dictFile.write(u"symbols:\r\n")
for pattern, description in cldrDict.iteritems():
dictFile.write(u"{pattern}\t{description}\tsome\r\n".format(
pattern=pattern,
description=description
))
cldrDictAction=env.Action(
lambda target,source,env: createCLDRAnnotationsDict([src.path for src in source], target[0].path),
lambda target,source,env: 'Generating %s'%target[0],
)
cldrDictBuilder=env.Builder(
action=cldrDictAction,
suffix='.dic',
src_suffix='.xml',
)
env['BUILDERS']['cldrDict']=cldrDictBuilder
NVDAToCLDRLocales = {
"af_ZA":("af",),
"am":("am",),
#"an":(),
"ar":("ar",),
"as":("as",),
"bg":("bg",),
"bn":("bn",),
"ca":("ca",),
#"ckb":(),
"cs":("cs",),
"da":("da",),
"de":("de",),
"de_CH":("de_CH",),
"el":("el",),
"en":("en_001","en"),
"es":("es",),
#"es_CO":(),
"fa":("fa",),
"fi":("fi",),
"fr":("fr",),
"ga":("ga",),
"gl":("gl",),
"gu":("gu",),
"he":("he",),
"hi":("hi",),
"hr":("hr",),
"hu":("hu",),
"id":("id",),
"is":("is",),
"it":("it",),
"ja":("ja",),
"ka":("ka",),
#"kmr":(),
"kn":("kn",),
"ko":("ko",),
#"kok":(),
"ky":("ky",),
"lt":("lt",),
"mk":("mk",),
"ml":("ml",),
"mn":("mn",),
#"mni":(),
"my":("my",),
"nb_NO":("nb",),
"ne":("ne",),
"nl":("nl",),
"nn_NO":("nn",),
"pa":("pa",),
"pl":("pl",),
"pt_BR":("pt",),
"pt_pt":("pt","pt_PT"),
"ro":("ro",),
"ru":("ru",),
"sk":("sk",),
"sl":("sl",),
#"so":(),
"sq":("sq",),
"sr":("sr",),
"sv":("sv",),
"ta":("ta",),
"te":("te",),
"th":("th",),
"tr":("tr",),
"uk":("uk",),
"vi":("vi",),
"zh_cn":("zh",),
"zh_hk":("zh","zh_Hant_HK"),
"zh_tw":("zh","zh_Hant"),
}
annotationsDir = env.Dir("include/cldr-emoji-annotation/annotations")
annotationsDerivedDir = env.Dir("include/cldr-emoji-annotation/annotationsDerived")
for destLocale, sourceLocales in NVDAToCLDRLocales.iteritems():
cldrSources = []
# First add all annotations, then the derived ones.
for sourceLocale in sourceLocales:
cldrSources.append(annotationsDir.File("%s.xml" % sourceLocale))
for sourceLocale in sourceLocales:
cldrSources.append(annotationsDerivedDir.File("%s.xml" % sourceLocale))
env.cldrDict(sourceDir.Dir("locale/%s" % destLocale).File("cldr.dic"), cldrSources)