Index: android/patch_locale.sh |
diff --git a/android/patch_locale.sh b/android/patch_locale.sh |
index af42d6a813272ef4eff75d091db066c24b87a4de..1724a8af7ade7c6f70c46498667966360a3e5a66 100755 |
--- a/android/patch_locale.sh |
+++ b/android/patch_locale.sh |
@@ -3,21 +3,86 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+# Keep only the currencies used by the larget 60 economies in terms of GDP |
+# with several more added in. |
+# TODO(jshin): Use ucurr_isAvailable in ICU to drop more currencies. |
+# See also http://en.wikipedia.org/wiki/List_of_circulating_currencies |
+# Copied from scripts/trim_data.sh. Need to refactor. |
+for currency in $(grep -v '^#' currencies.list) |
+do |
+ OP=${KEEPLIST:+|} |
+ KEEPLIST=${KEEPLIST}${OP}${currency} |
+done |
+KEEPLIST="(${KEEPLIST})" |
+ |
cd $(dirname $0)/../source/data |
-# Excludes curr data which is not used on Android. |
-echo Overwriting curr/reslocal.mk... |
-cat >curr/reslocal.mk <<END |
-CURR_CLDR_VERSION = 1.9 |
-CURR_SYNTHETIC_ALIAS = |
-CURR_ALIAS_SOURCE = |
-CURR_SOURCE = |
-END |
+for i in curr/*.txt |
+do |
+ locale=$(basename $i .txt) |
+ [ $locale == 'supplementalData' ] && continue; |
+ echo "Overwriting $i for $locale" |
+ sed -n -r -i \ |
+ '1, /^'${locale}'\{$/ p |
+ /^ "%%ALIAS"\{/p |
+ /^ %%Parent\{/p |
+ /^ Currencies\{$/, /^ \}$/ { |
+ /^ Currencies\{$/ p |
+ /^ '$KEEPLIST'\{$/, /^ \}$/ p |
+ /^ \}$/ p |
+ } |
+ /^ Currencies%narrow\{$/, /^ \}$/ { |
+ /^ Currencies%narrow\{$/ p |
+ /^ '$KEEPLIST'\{".*\}$/ p |
+ /^ \}$/ p |
+ } |
+ /^ CurrencyPlurals\{$/, /^ \}$/ { |
+ /^ CurrencyPlurals\{$/ p |
+ /^ '$KEEPLIST'\{$/, /^ \}$/ p |
+ /^ \}$/ p |
+ } |
+ /^ [cC]urrency(Map|Meta|Spacing|UnitPatterns)\{$/, /^ \}$/ p |
+ /^ Version\{.*\}$/p |
+ /^\}$/p' $i |
+done |
+ |
+# Chrome on Android is not localized to the following languages and we |
+# have to minimize the locale data for them. |
+EXTRA_LANGUAGES="bn et gu kn ml mr ms ta te" |
+ |
+# TODO(jshin): Copied from scripts/trim_data.sh. Need to refactor. |
+echo Creating minimum locale data in locales |
+for lang in ${EXTRA_LANGUAGES} |
+do |
+ target=locales/${lang}.txt |
+ [ -e ${target} ] || { echo "missing ${lang}"; continue; } |
+ echo Overwriting ${target} ... |
+ |
+ # Do not include '%%Parent' line on purpose. |
+ sed -n -r -i \ |
+ '1, /^'${lang}'\{$/p |
+ /^ "%%ALIAS"\{/p |
+ /^ AuxExemplarCharacters\{.*\}$/p |
+ /^ AuxExemplarCharacters\{$/, /^ \}$/p |
+ /^ ExemplarCharacters\{.*\}$/p |
+ /^ ExemplarCharacters\{$/, /^ \}$/p |
+ /^ (LocaleScript|layout)\{$/, /^ \}$/p |
+ /^ Version\{.*$/p |
+ /^\}$/p' ${target} |
+done |
+ |
+echo Overwriting curr/reslocal.mk to drop the currency names |
+echo for ${EXTRA_LANGUAGES} |
+for lang in ${EXTRA_LANGUAGES} |
+do |
+ sed -i -e '/'$lang'.txt/ d' curr/reslocal.mk |
+done |
+ |
# Excludes region data. On Android Java API is used to get the data. |
echo Overwriting region/reslocal.mk... |
cat >region/reslocal.mk <<END |
-REGION_CLDR_VERSION = 1.9 |
+REGION_CLDR_VERSION = %version% |
REGION_SYNTHETIC_ALIAS = |
REGION_ALIAS_SOURCE = |
REGION_SOURCE = |