OLD | NEW |
1 #!/bin/sh | 1 #!/bin/bash |
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 | 6 # Keep only the currencies used by the larget 60 economies in terms of GDP |
7 # with several more added in. | 7 # with several more added in. |
8 # TODO(jshin): Use ucurr_isAvailable in ICU to drop more currencies. | 8 # TODO(jshin): Use ucurr_isAvailable in ICU to drop more currencies. |
9 # See also http://en.wikipedia.org/wiki/List_of_circulating_currencies | 9 # See also http://en.wikipedia.org/wiki/List_of_circulating_currencies |
10 # Copied from scripts/trim_data.sh. Need to refactor. | 10 # Copied from scripts/trim_data.sh. Need to refactor. |
11 for currency in $(grep -v '^#' currencies.list) | 11 for currency in $(grep -v '^#' $(dirname $0)/currencies.list) |
12 do | 12 do |
13 OP=${KEEPLIST:+|} | 13 OP=${KEEPLIST:+|} |
14 KEEPLIST=${KEEPLIST}${OP}${currency} | 14 KEEPLIST=${KEEPLIST}${OP}${currency} |
15 done | 15 done |
16 KEEPLIST="(${KEEPLIST})" | 16 KEEPLIST="(${KEEPLIST})" |
17 | 17 |
18 cd $(dirname $0)/../source/data | 18 cd $(dirname $0)/../source/data |
19 | 19 |
20 for i in curr/*.txt | 20 for i in curr/*.txt |
21 do | 21 do |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 /^ "meta:/ p | 127 /^ "meta:/ p |
128 d | 128 d |
129 }' $i | 129 }' $i |
130 done | 130 done |
131 | 131 |
132 # Keep only two common calendars. Add locale-specific calendars only to | 132 # Keep only two common calendars. Add locale-specific calendars only to |
133 # locales that are likely to use them most. | 133 # locales that are likely to use them most. |
134 COMMON_CALENDARS="gregorian|generic" | 134 COMMON_CALENDARS="gregorian|generic" |
135 for i in locales/*.txt; do | 135 for i in locales/*.txt; do |
136 CALENDARS="${COMMON_CALENDARS}" | 136 CALENDARS="${COMMON_CALENDARS}" |
| 137 EXTRA_CAL= |
137 case $(basename $i .txt | sed 's/_.*$//') in | 138 case $(basename $i .txt | sed 's/_.*$//') in |
138 th) | 139 th) |
139 EXTRA_CAL='buddhist' | 140 EXTRA_CAL='buddhist' |
140 ;; | 141 ;; |
141 zh) | 142 zh) |
142 EXTRA_CAL='chinese' | 143 EXTRA_CAL='chinese' |
143 ;; | 144 ;; |
144 ko) | 145 ko) |
145 EXTRA_CAL='dangi' | 146 EXTRA_CAL='dangi' |
146 ;; | 147 ;; |
(...skipping 23 matching lines...) Expand all Loading... |
170 echo Overwriting $i... | 171 echo Overwriting $i... |
171 sed -r '/^ calendar\{$/,/^ \}$/ { | 172 sed -r '/^ calendar\{$/,/^ \}$/ { |
172 /^ calendar\{$/p | 173 /^ calendar\{$/p |
173 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p | 174 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p |
174 /^ \}$/p | 175 /^ \}$/p |
175 d | 176 d |
176 }' -i $i | 177 }' -i $i |
177 done | 178 done |
178 | 179 |
179 echo DONE. | 180 echo DONE. |
OLD | NEW |