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 | 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. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 ;; | 157 ;; |
158 ar) | 158 ar) |
159 EXTRA_CAL='arabic' | 159 EXTRA_CAL='arabic' |
160 ;; | 160 ;; |
161 fa) | 161 fa) |
162 EXTRA_CAL='persian' | 162 EXTRA_CAL='persian' |
163 ;; | 163 ;; |
164 ja) | 164 ja) |
165 EXTRA_CAL='japanese' | 165 EXTRA_CAL='japanese' |
166 ;; | 166 ;; |
167 *) | |
168 EXTRA_CAL='' | |
169 ;; | |
167 esac | 170 esac |
168 | 171 |
169 # Add 'roc' calendar to zh_Hant*. | 172 # Add 'roc' calendar to zh_Hant*. |
170 [[ "$(basename $i .txt)" =~ 'zh_Hant' ]] && { EXTRA_CAL="$EXTRA_CAL|roc"; } | 173 [[ "$(basename $i .txt)" =~ 'zh_Hant' ]] && { EXTRA_CAL="${EXTRA_CAL}|roc"; } |
171 | 174 |
172 CAL_PATTERN="(${COMMON_CALENDARS}|${EXTRA_CAL})" | 175 CAL_PATTERN="(${COMMON_CALENDARS})" |
Mark Mentovai
2015/04/03 12:51:09
You can write all of this in one line:
CAL_PATT
| |
176 [[ -n "${EXTRA_CAL}" ]] && \ | |
177 { CAL_PATTERN="(${COMMON_CALENDARS}|${EXTRA_CAL})"; } | |
173 echo $CAL_PATTERN | 178 echo $CAL_PATTERN |
174 | 179 |
175 echo Overwriting $i... | 180 echo Overwriting $i... |
176 sed -r '/^ calendar\{$/,/^ \}$/ { | 181 sed -r '/^ calendar\{$/,/^ \}$/ { |
177 /^ calendar\{$/p | 182 /^ calendar\{$/p |
178 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p | 183 /^ '${CAL_PATTERN}'\{$/, /^ \}$/p |
179 /^ \}$/p | 184 /^ \}$/p |
180 d | 185 d |
181 }' -i $i | 186 }' -i $i |
182 done | 187 done |
183 | 188 |
184 echo DONE. | 189 echo DONE. |
OLD | NEW |