OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
| 6 # Keep only the currencies used by the larget 60 economies in terms of GDP |
| 7 # with several more added in. |
| 8 # TODO(jshin): Use ucurr_isAvailable in ICU to drop more currencies. |
| 9 # See also http://en.wikipedia.org/wiki/List_of_circulating_currencies |
| 10 # Copied from scripts/trim_data.sh. Need to refactor. |
| 11 for currency in $(grep -v '^#' currencies.list) |
| 12 do |
| 13 OP=${KEEPLIST:+|} |
| 14 KEEPLIST=${KEEPLIST}${OP}${currency} |
| 15 done |
| 16 KEEPLIST="(${KEEPLIST})" |
| 17 |
6 cd $(dirname $0)/../source/data | 18 cd $(dirname $0)/../source/data |
7 | 19 |
8 # Excludes curr data which is not used on Android. | 20 for i in curr/*.txt |
9 echo Overwriting curr/reslocal.mk... | 21 do |
10 cat >curr/reslocal.mk <<END | 22 locale=$(basename $i .txt) |
11 CURR_CLDR_VERSION = 1.9 | 23 [ $locale == 'supplementalData' ] && continue; |
12 CURR_SYNTHETIC_ALIAS = | 24 echo "Overwriting $i for $locale" |
13 CURR_ALIAS_SOURCE = | 25 sed -n -r -i \ |
14 CURR_SOURCE = | 26 '1, /^'${locale}'\{$/ p |
15 END | 27 /^ "%%ALIAS"\{/p |
| 28 /^ %%Parent\{/p |
| 29 /^ Currencies\{$/, /^ \}$/ { |
| 30 /^ Currencies\{$/ p |
| 31 /^ '$KEEPLIST'\{$/, /^ \}$/ p |
| 32 /^ \}$/ p |
| 33 } |
| 34 /^ Currencies%narrow\{$/, /^ \}$/ { |
| 35 /^ Currencies%narrow\{$/ p |
| 36 /^ '$KEEPLIST'\{".*\}$/ p |
| 37 /^ \}$/ p |
| 38 } |
| 39 /^ CurrencyPlurals\{$/, /^ \}$/ { |
| 40 /^ CurrencyPlurals\{$/ p |
| 41 /^ '$KEEPLIST'\{$/, /^ \}$/ p |
| 42 /^ \}$/ p |
| 43 } |
| 44 /^ [cC]urrency(Map|Meta|Spacing|UnitPatterns)\{$/, /^ \}$/ p |
| 45 /^ Version\{.*\}$/p |
| 46 /^\}$/p' $i |
| 47 done |
| 48 |
| 49 # Chrome on Android is not localized to the following languages and we |
| 50 # have to minimize the locale data for them. |
| 51 EXTRA_LANGUAGES="bn et gu kn ml mr ms ta te" |
| 52 |
| 53 # TODO(jshin): Copied from scripts/trim_data.sh. Need to refactor. |
| 54 echo Creating minimum locale data in locales |
| 55 for lang in ${EXTRA_LANGUAGES} |
| 56 do |
| 57 target=locales/${lang}.txt |
| 58 [ -e ${target} ] || { echo "missing ${lang}"; continue; } |
| 59 echo Overwriting ${target} ... |
| 60 |
| 61 # Do not include '%%Parent' line on purpose. |
| 62 sed -n -r -i \ |
| 63 '1, /^'${lang}'\{$/p |
| 64 /^ "%%ALIAS"\{/p |
| 65 /^ AuxExemplarCharacters\{.*\}$/p |
| 66 /^ AuxExemplarCharacters\{$/, /^ \}$/p |
| 67 /^ ExemplarCharacters\{.*\}$/p |
| 68 /^ ExemplarCharacters\{$/, /^ \}$/p |
| 69 /^ (LocaleScript|layout)\{$/, /^ \}$/p |
| 70 /^ Version\{.*$/p |
| 71 /^\}$/p' ${target} |
| 72 done |
| 73 |
| 74 echo Overwriting curr/reslocal.mk to drop the currency names |
| 75 echo for ${EXTRA_LANGUAGES} |
| 76 for lang in ${EXTRA_LANGUAGES} |
| 77 do |
| 78 sed -i -e '/'$lang'.txt/ d' curr/reslocal.mk |
| 79 done |
| 80 |
16 | 81 |
17 # Excludes region data. On Android Java API is used to get the data. | 82 # Excludes region data. On Android Java API is used to get the data. |
18 echo Overwriting region/reslocal.mk... | 83 echo Overwriting region/reslocal.mk... |
19 cat >region/reslocal.mk <<END | 84 cat >region/reslocal.mk <<END |
20 REGION_CLDR_VERSION = 1.9 | 85 REGION_CLDR_VERSION = %version% |
21 REGION_SYNTHETIC_ALIAS = | 86 REGION_SYNTHETIC_ALIAS = |
22 REGION_ALIAS_SOURCE = | 87 REGION_ALIAS_SOURCE = |
23 REGION_SOURCE = | 88 REGION_SOURCE = |
24 END | 89 END |
25 | 90 |
26 # On Android Java API is used to get lang data, except for the language and | 91 # On Android Java API is used to get lang data, except for the language and |
27 # script names for zh_Hans and zh_Hant which are not supported by Java API. | 92 # script names for zh_Hans and zh_Hant which are not supported by Java API. |
28 # Here remove all lang data except those names. | 93 # Here remove all lang data except those names. |
29 # See the comments in GetDisplayNameForLocale() (in Chromium's | 94 # See the comments in GetDisplayNameForLocale() (in Chromium's |
30 # src/ui/base/l10n/l10n_util.cc) about why we need the scripts. | 95 # src/ui/base/l10n/l10n_util.cc) about why we need the scripts. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 echo Overwriting $i... | 170 echo Overwriting $i... |
106 sed -r '/^ calendar\{$/,/^ \}$/ { | 171 sed -r '/^ calendar\{$/,/^ \}$/ { |
107 /^ calendar\{$/p | 172 /^ calendar\{$/p |
108 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p | 173 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p |
109 /^ \}$/p | 174 /^ \}$/p |
110 d | 175 d |
111 }' -i $i | 176 }' -i $i |
112 done | 177 done |
113 | 178 |
114 echo DONE. | 179 echo DONE. |
OLD | NEW |