mirror of
https://gitee.com/openharmony/third_party_icu
synced 2024-11-22 23:59:46 +00:00
commit
9e630e5eb9
@ -60,7 +60,10 @@ static const int32_t gOffsets[] = {
|
||||
450,
|
||||
454,
|
||||
456,
|
||||
490
|
||||
490,
|
||||
/* IASH19 Add 10 measure units 20241104 begin */
|
||||
500
|
||||
/* IASH19 Add 10 measure units 20241104 end */
|
||||
};
|
||||
|
||||
static const int32_t kCurrencyOffset = 5;
|
||||
@ -89,7 +92,10 @@ static const char * const gTypes[] = {
|
||||
"speed",
|
||||
"temperature",
|
||||
"torque",
|
||||
"volume"
|
||||
"volume",
|
||||
/* IASH19 Add 10 measure units 20241104 begin */
|
||||
"zohos"
|
||||
/* IASH19 Add 10 measure units 20241104 end */
|
||||
};
|
||||
|
||||
// Must be grouped by type and sorted alphabetically within each type.
|
||||
@ -583,7 +589,19 @@ static const char * const gSubTypes[] = {
|
||||
"quart",
|
||||
"quart-imperial",
|
||||
"tablespoon",
|
||||
"teaspoon"
|
||||
"teaspoon",
|
||||
/* IASH19 Add 10 measure units 20241104 begin */
|
||||
"beat-per-minute",
|
||||
"body-weight-per-second",
|
||||
"breath-per-minute",
|
||||
"foot-per-hour",
|
||||
"jump-rope-per-minute",
|
||||
"meter-per-hour",
|
||||
"milliliter-per-minute-per-kilogram",
|
||||
"rotation-per-minute",
|
||||
"step-per-minute",
|
||||
"stroke-per-minute"
|
||||
/* IASH19 Add 10 measure units 20241104 end */
|
||||
};
|
||||
|
||||
// Shortcuts to the base unit in order to make the default constructor fast
|
||||
|
@ -1,3 +1,15 @@
|
||||
{
|
||||
"strategy": "subtractive"
|
||||
"strategy": "subtractive",
|
||||
"fileReplacements": {
|
||||
"directory": "$FILTERS",
|
||||
"replacements": [
|
||||
"unit/bo.txt",
|
||||
"unit/en_001.txt",
|
||||
"unit/root.txt",
|
||||
"unit/ug.txt",
|
||||
"unit/zh.txt",
|
||||
"unit/zh_Hant.txt",
|
||||
"unit/zh_Hant_HK.txt"
|
||||
]
|
||||
}
|
||||
}
|
42
ohos_icu4c/build_data/full/unit/bo.txt
Normal file
42
ohos_icu4c/build_data/full/unit/bo.txt
Normal file
@ -0,0 +1,42 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
dnam{"སྐར་མ་རེར་ཐེངས་"}
|
||||
other{"སྐར་མ་རེར་ཐེངས་ {0}"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
dnam{"BW/s"}
|
||||
other{"{0} BW/s"}
|
||||
}
|
||||
breath-per-minute{
|
||||
dnam{"སྐར་མ་རེར་ཐེངས་"}
|
||||
other{"སྐར་མ་རེར་ཐེངས་ {0}"}
|
||||
}
|
||||
foot-per-hour{
|
||||
dnam{"ft/h"}
|
||||
other{"{0} ft/h"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
dnam{"སྐར་མ་རེར་"}
|
||||
other{"སྐར་མ་རེར་ {0}"}
|
||||
}
|
||||
meter-per-hour{
|
||||
dnam{"m/h"}
|
||||
other{"{0} m/h"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
dnam{"ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
dnam{"སྐར་མ་རེར་སྐོར་བ་"}
|
||||
other{"སྐར་མ་རེར་སྐོར་བ་ {0}"}
|
||||
}
|
||||
step-per-minute{
|
||||
dnam{"སྐར་མ་རེར་གོམ་པ་"}
|
||||
other{"སྐར་མ་རེར་གོམ་པ་ {0}"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
dnam{"སྐར་མ་རེར་ཐེངས་"}
|
||||
other{"སྐར་མ་རེར་ཐེངས་ {0}"}
|
||||
}
|
||||
}
|
7
ohos_icu4c/build_data/full/unit/en_001.txt
Normal file
7
ohos_icu4c/build_data/full/unit/en_001.txt
Normal file
@ -0,0 +1,7 @@
|
||||
zohos{
|
||||
jump-rope-per-minute{
|
||||
dnam{"skip/minute"}
|
||||
one{"{0} skip/minute"}
|
||||
other{"{0} skips/minute"}
|
||||
}
|
||||
}
|
45
ohos_icu4c/build_data/full/unit/root.txt
Normal file
45
ohos_icu4c/build_data/full/unit/root.txt
Normal file
@ -0,0 +1,45 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
dnam{"bpm"}
|
||||
other{"{0} bpm"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
dnam{"BW/s"}
|
||||
other{"{0} BW/s"}
|
||||
}
|
||||
breath-per-minute{
|
||||
dnam{"brpm"}
|
||||
other{"{0} brpm"}
|
||||
}
|
||||
foot-per-hour{
|
||||
dnam{"ft/h"}
|
||||
other{"{0} ft/h"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
dnam{"jump/minute"}
|
||||
one{"{0} jump/minute"}
|
||||
other{"{0} jumps/minute"}
|
||||
}
|
||||
meter-per-hour{
|
||||
dnam{"m/h"}
|
||||
other{"{0} m/h"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
dnam{"ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
dnam{"rpm"}
|
||||
other{"{0} rpm"}
|
||||
}
|
||||
step-per-minute{
|
||||
dnam{"step/min"}
|
||||
one{"{0} step/min"}
|
||||
other{"{0} steps/min"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
dnam{"stroke/min"}
|
||||
one{"{0} stroke/min"}
|
||||
other{"{0} strokes/min"}
|
||||
}
|
||||
}
|
42
ohos_icu4c/build_data/full/unit/ug.txt
Normal file
42
ohos_icu4c/build_data/full/unit/ug.txt
Normal file
@ -0,0 +1,42 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
one{"{0} ق/م"}
|
||||
other{"{0} ق/م"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
one{"{0} BW/s"}
|
||||
other{"{0} BW/s"}
|
||||
}
|
||||
breath-per-minute{
|
||||
one{"{0} ق/م"}
|
||||
other{"{0} ق/م"}
|
||||
}
|
||||
foot-per-hour{
|
||||
one{"{0} ft/h"}
|
||||
other{"{0} ft/h"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
one{"{0} ئاتلام/مىنۇت"}
|
||||
other{"{0} ئاتلام/مىنۇت"}
|
||||
}
|
||||
meter-per-hour{
|
||||
one{"{0} m/h"}
|
||||
other{"{0} m/h"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
one{"{0} ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
one{"{0} ق/م"}
|
||||
other{"{0} ق/م"}
|
||||
}
|
||||
step-per-minute{
|
||||
one{"{0} قەدەم/مىنۇت"}
|
||||
other{"{0} قەدەم/مىنۇت"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
one{"{0} پالاق/مىنۇت"}
|
||||
other{"{0} پالاق/مىنۇت"}
|
||||
}
|
||||
}
|
42
ohos_icu4c/build_data/full/unit/zh.txt
Normal file
42
ohos_icu4c/build_data/full/unit/zh.txt
Normal file
@ -0,0 +1,42 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
dnam{"次/分钟"}
|
||||
other{"{0} 次/分钟"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
dnam{"BW/s"}
|
||||
other{"{0} BW/s"}
|
||||
}
|
||||
breath-per-minute{
|
||||
dnam{"次/分"}
|
||||
other{"{0} 次/分"}
|
||||
}
|
||||
foot-per-hour{
|
||||
dnam{"英尺/小时"}
|
||||
other{"{0} 英尺/小时"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
dnam{"个/分钟"}
|
||||
other{"{0} 个/分钟"}
|
||||
}
|
||||
meter-per-hour{
|
||||
dnam{"米/小时"}
|
||||
other{"{0} 米/小时"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
dnam{"ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
dnam{"转/分钟"}
|
||||
other{"{0} 转/分钟"}
|
||||
}
|
||||
step-per-minute{
|
||||
dnam{"步/分钟"}
|
||||
other{"{0} 步/分钟"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
dnam{"次/分钟"}
|
||||
other{"{0} 次/分钟"}
|
||||
}
|
||||
}
|
42
ohos_icu4c/build_data/full/unit/zh_Hant.txt
Normal file
42
ohos_icu4c/build_data/full/unit/zh_Hant.txt
Normal file
@ -0,0 +1,42 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
dnam{"次/分鐘"}
|
||||
other{"{0} 次/分鐘"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
dnam{"BW/s"}
|
||||
other{"{0} BW/s"}
|
||||
}
|
||||
breath-per-minute{
|
||||
dnam{"次/分"}
|
||||
other{"{0} 次/分"}
|
||||
}
|
||||
foot-per-hour{
|
||||
dnam{"英尺/小時"}
|
||||
other{"{0} 英尺/小時"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
dnam{"個/分鐘"}
|
||||
other{"{0} 個/分鐘"}
|
||||
}
|
||||
meter-per-hour{
|
||||
dnam{"公尺/小時"}
|
||||
other{"{0} 公尺/小時"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
dnam{"ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
dnam{"轉/分鐘"}
|
||||
other{"{0} 轉/分鐘"}
|
||||
}
|
||||
step-per-minute{
|
||||
dnam{"步/分鐘"}
|
||||
other{"{0} 步/分鐘"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
dnam{"次/分鐘"}
|
||||
other{"{0} 次/分鐘"}
|
||||
}
|
||||
}
|
42
ohos_icu4c/build_data/full/unit/zh_Hant_HK.txt
Normal file
42
ohos_icu4c/build_data/full/unit/zh_Hant_HK.txt
Normal file
@ -0,0 +1,42 @@
|
||||
zohos{
|
||||
beat-per-minute{
|
||||
dnam{"下/分鐘"}
|
||||
other{"{0} 下/分鐘"}
|
||||
}
|
||||
body-weight-per-second{
|
||||
dnam{"體重/秒"}
|
||||
other{"{0} 體重/秒"}
|
||||
}
|
||||
breath-per-minute{
|
||||
dnam{"下/分鐘"}
|
||||
other{"{0} 下/分鐘"}
|
||||
}
|
||||
foot-per-hour{
|
||||
dnam{"呎/小時"}
|
||||
other{"{0} 呎/小時"}
|
||||
}
|
||||
jump-rope-per-minute{
|
||||
dnam{"下/分鐘"}
|
||||
other{"{0} 下/分鐘"}
|
||||
}
|
||||
meter-per-hour{
|
||||
dnam{"米/小時"}
|
||||
other{"{0} 米/小時"}
|
||||
}
|
||||
milliliter-per-minute-per-kilogram{
|
||||
dnam{"ml/kg/min"}
|
||||
other{"{0} ml/kg/min"}
|
||||
}
|
||||
rotation-per-minute{
|
||||
dnam{"轉/分鐘"}
|
||||
other{"{0} 轉/分鐘"}
|
||||
}
|
||||
step-per-minute{
|
||||
dnam{"步/分鐘"}
|
||||
other{"{0} 步/分鐘"}
|
||||
}
|
||||
stroke-per-minute{
|
||||
dnam{"下/分鐘"}
|
||||
other{"{0} 下/分鐘"}
|
||||
}
|
||||
}
|
108
ohos_icu4c/build_data/ohos_data.py
Normal file
108
ohos_icu4c/build_data/ohos_data.py
Normal file
@ -0,0 +1,108 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
|
||||
def add_content(data, src_content, prefix=''):
|
||||
if len(prefix) == 0:
|
||||
for content in src_content:
|
||||
data = data + ' ' + content + '\n'
|
||||
else:
|
||||
data = data + ' ' + prefix + '{' + '\n'
|
||||
for content in src_content:
|
||||
data = data + ' ' + content + '\n'
|
||||
data = data + ' }' + '\n'
|
||||
return data
|
||||
|
||||
|
||||
def copy_content(src_file, dest_file, out_file):
|
||||
if os.path.exists(src_file):
|
||||
with open(src_file, 'r', encoding='utf-8') as f:
|
||||
src_content = f.read().splitlines()
|
||||
else:
|
||||
src_content = []
|
||||
|
||||
with open(dest_file, 'r', encoding='utf-8') as f:
|
||||
dest_content = f.read().splitlines(True)
|
||||
|
||||
data = ''
|
||||
signal = 0
|
||||
for index in range(len(dest_content)):
|
||||
line = dest_content[index]
|
||||
|
||||
if (index == len(dest_content) - 1) and (signal != 3):
|
||||
if signal == 0:
|
||||
data = add_content(data, src_content, 'units')
|
||||
signal = 1
|
||||
if signal == 1:
|
||||
data = add_content(data, src_content, 'unitsNarrow')
|
||||
signal = 2
|
||||
if signal == 2:
|
||||
data = add_content(data, src_content, 'unitsShort')
|
||||
data += line
|
||||
elif ('unitsShort{' in line) or ('unitsShort:' in line):
|
||||
if signal == 0:
|
||||
data = add_content(data, src_content, 'units')
|
||||
signal = 1
|
||||
if signal == 1:
|
||||
data = add_content(data, src_content, 'unitsNarrow')
|
||||
data += line
|
||||
if 'unitsShort{' in line:
|
||||
data = add_content(data, src_content)
|
||||
signal = 3
|
||||
elif ('unitsNarrow{' in line) or ('unitsNarrow:' in line):
|
||||
if signal == 0:
|
||||
data = add_content(data, src_content, 'units')
|
||||
data += line
|
||||
if 'unitsNarrow{' in line:
|
||||
data = add_content(data, src_content)
|
||||
signal = 2
|
||||
elif ('units{' in line) or ('units:' in line):
|
||||
data += line
|
||||
if 'units{' in line:
|
||||
data = add_content(data, src_content)
|
||||
signal = 1
|
||||
else:
|
||||
data += line
|
||||
|
||||
with open(out_file, 'w', encoding='utf-8') as f:
|
||||
f.write(data)
|
||||
|
||||
|
||||
def copy_file(src_file, dest_file):
|
||||
with open(src_file, 'r', encoding='utf-8') as f:
|
||||
data = f.read()
|
||||
|
||||
with open(dest_file, 'w', encoding='utf-8') as f:
|
||||
f.write(data)
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--icu_src_dir', type=str)
|
||||
parser.add_argument('--ohos_src_dir', type=str)
|
||||
parser.add_argument('--out_dir', type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
out_dir = args.out_dir + '/out/temp/'
|
||||
unit_path = '/unit/'
|
||||
filter_file = '/data_filter.json'
|
||||
os.makedirs(out_dir + unit_path, exist_ok=True)
|
||||
|
||||
for file in os.listdir(args.ohos_src_dir + unit_path):
|
||||
copy_content(args.ohos_src_dir + unit_path + file,
|
||||
args.icu_src_dir + unit_path + file, out_dir + unit_path + file)
|
||||
|
||||
copy_file(args.ohos_src_dir + filter_file, out_dir + filter_file)
|
@ -61,6 +61,11 @@ icu_data_filter_file="$script_path/$icu_data_filter_dir/data_filter.json"
|
||||
|
||||
rm -rf "$out_put_root_path/thirdparty/icu/out/*"
|
||||
|
||||
python3 $script_path/ohos_data.py \
|
||||
--icu_src_dir "$icu_source_path/source/data" \
|
||||
--ohos_src_dir "$script_path/$icu_data_filter_dir/" \
|
||||
--out_dir "$out_put_root_path/thirdparty/icu" \
|
||||
|
||||
gen_icu_data() {
|
||||
|
||||
# compile to res file
|
||||
@ -68,7 +73,7 @@ gen_icu_data() {
|
||||
--src_dir $icu_source_path/source/data \
|
||||
--include_uni_core_data \
|
||||
--seqmode sequential \
|
||||
--filter_file $icu_data_filter_file \
|
||||
--filter_file $out_put_root_path/thirdparty/icu/out/temp/data_filter.json \
|
||||
--mode unix-exec \
|
||||
--tool_dir $tool_bin_dir \
|
||||
--out_dir $res_out_root_dir/out/build/$icu_dat_name \
|
||||
|
Loading…
Reference in New Issue
Block a user