summaryrefslogtreecommitdiff
path: root/tools/localedata
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2019-12-12 13:58:52 +0000
committerVictor Chang <vichang@google.com>2019-12-16 15:31:09 +0000
commite84c6b50c239794d1b70ff242855911ff823e505 (patch)
tree26536a5c4045d887ce35f97b1e0c85e941f68908 /tools/localedata
parent9dcbd6de8732df6e99c4f9c7bf41ccb777fedf54 (diff)
Regenerate LocaleDataTables.cpp
LocaleDataTables.cpp is outdated due to ICU update over the years Test: ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP Test: m droid Change-Id: I21918cc0f50c7347e514dc7b015607e19cffb377
Diffstat (limited to 'tools/localedata')
-rwxr-xr-xtools/localedata/extract_icu_data.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/localedata/extract_icu_data.py b/tools/localedata/extract_icu_data.py
index 6b4c34677d96..ca1847af7d06 100755
--- a/tools/localedata/extract_icu_data.py
+++ b/tools/localedata/extract_icu_data.py
@@ -176,6 +176,9 @@ def read_and_dump_likely_data(icu_data_dir):
dump_representative_locales(representative_locales)
return likely_script_dict
+def escape_script_variable_name(script):
+ """Escape characters, e.g. '~', in a C++ variable name"""
+ return script.replace("~", "_")
def read_parent_data(icu_data_dir):
"""Read locale parent data from ICU data files."""
@@ -221,7 +224,7 @@ def dump_parent_data(script_organized_dict):
for script in sorted_scripts:
parent_dict = script_organized_dict[script]
print ('const std::unordered_map<uint32_t, uint32_t> %s_PARENTS({'
- % script.upper())
+ % escape_script_variable_name(script.upper()))
for locale in sorted(parent_dict.keys()):
parent = parent_dict[locale]
print ' {0x%08Xu, 0x%08Xu}, // %s -> %s' % (
@@ -239,7 +242,7 @@ def dump_parent_data(script_organized_dict):
for script in sorted_scripts:
print " {{'%c', '%c', '%c', '%c'}, &%s_PARENTS}," % (
script[0], script[1], script[2], script[3],
- script.upper())
+ escape_script_variable_name(script.upper()))
print '};'