OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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 | 6 |
7 # Remove display names for languages that are not listed in the accept-language | 7 # Remove display names for languages that are not listed in the accept-language |
8 # list of Chromium. | 8 # list of Chromium. |
9 function filter_display_language_names { | 9 function filter_display_language_names { |
10 UI_LANG_PATTERN="(${UI_LANGUAGES})[^a-z]" | 10 UI_LANG_PATTERN="(${UI_LANGUAGES})[^a-z]" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 do | 99 do |
100 [ $i != 'root.txt' ] && \ | 100 [ $i != 'root.txt' ] && \ |
101 sed -i '/^ zoneStrings/, /^ "meta:/ { | 101 sed -i '/^ zoneStrings/, /^ "meta:/ { |
102 /^ zoneStrings/ p | 102 /^ zoneStrings/ p |
103 /^ "meta:/ p | 103 /^ "meta:/ p |
104 d | 104 d |
105 }' $i | 105 }' $i |
106 done | 106 done |
107 } | 107 } |
108 | 108 |
| 109 # Keep only duration and compound in units* sections. |
| 110 function filter_locale_data { |
| 111 for i in "${dataroot}/locales/*.txt" |
| 112 do |
| 113 echo Overwriting $i ... |
| 114 sed -r -i \ |
| 115 '/^ units(|Narrow|Short)\{$/, /^ \}$/ { |
| 116 /^ units(|Narrow|Short)\{$/ p |
| 117 /^ (duration|compound)\{$/, /^ \}$/ p |
| 118 /^ \}$/ p |
| 119 d |
| 120 }' ${i} |
| 121 done |
| 122 } |
| 123 |
109 # big5han and gb2312han collation do not make any sense and nobody uses them. | 124 # big5han and gb2312han collation do not make any sense and nobody uses them. |
110 function remove_legacy_chinese_codepoint_collation { | 125 function remove_legacy_chinese_codepoint_collation { |
111 echo "Removing Big5 / GB2312 collation data from Chinese locale" | 126 echo "Removing Big5 / GB2312 collation data from Chinese locale" |
112 target="${dataroot}/coll/zh.txt" | 127 target="${dataroot}/coll/zh.txt" |
113 echo "Overwriting ${target}" | 128 echo "Overwriting ${target}" |
114 sed -r -i '/^ (big5|gb2312)han\{$/,/^ \}$/ d' ${target} | 129 sed -r -i '/^ (big5|gb2312)han\{$/,/^ \}$/ d' ${target} |
115 } | 130 } |
116 | 131 |
117 dataroot="$(dirname $0)/../source/data" | 132 dataroot="$(dirname $0)/../source/data" |
118 localedatapath="${dataroot}/locales" | 133 localedatapath="${dataroot}/locales" |
119 langdatapath="${dataroot}/lang" | 134 langdatapath="${dataroot}/lang" |
120 | 135 |
121 for lang in $(grep -v '^#' chrome_ui_languages.list) | 136 for lang in $(grep -v '^#' chrome_ui_languages.list) |
122 do | 137 do |
123 # Set $OP to '|' only if $UI_LANGUAGES is not empty. | 138 # Set $OP to '|' only if $UI_LANGUAGES is not empty. |
124 OP=${UI_LANGUAGES:+|} | 139 OP=${UI_LANGUAGES:+|} |
125 UI_LANGUAGES="${UI_LANGUAGES}${OP}${lang}" | 140 UI_LANGUAGES="${UI_LANGUAGES}${OP}${lang}" |
126 done | 141 done |
127 | 142 |
128 | 143 |
129 filter_display_language_names | 144 filter_display_language_names |
130 abridge_locale_data_for_non_ui_languages | 145 abridge_locale_data_for_non_ui_languages |
131 filter_currency_data | 146 filter_currency_data |
132 filter_region_data | 147 filter_region_data |
133 remove_legacy_chinese_codepoint_collation | 148 remove_legacy_chinese_codepoint_collation |
| 149 filter_locale_data |
134 | 150 |
135 # Chromium OS needs exemplar cities for timezones, but not Chromium. | 151 # Chromium OS needs exemplar cities for timezones, but not Chromium. |
136 # It'll save 400kB (uncompressed), but the size difference in | 152 # It'll save 400kB (uncompressed), but the size difference in |
137 # 7z compressed installer is <= 100kB. | 153 # 7z compressed installer is <= 100kB. |
138 # TODO(jshin): Make separate data files for CrOS and Chromium. | 154 # TODO(jshin): Make separate data files for CrOS and Chromium. |
139 #fremove_exemplar_cities | 155 #remove_exemplar_cities |
140 | |
141 | |
OLD | NEW |