diff --git a/UI/International/README_zh.md b/UI/International/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..aac91ef172442e50bd8ba0992d2617f16684cd26 --- /dev/null +++ b/UI/International/README_zh.md @@ -0,0 +1,19 @@ +# 国际化 + +### 简介 + +不同地域,同一日期在国际化之后,拥有不同的格式。本示例展示了英国、中国、日本三个地域对同一日期进行国际化。 + +### 使用说明 + +应用直接获取系统当前时间 + +1.点击“英文国际化”,将获取到的系统时间进行英文国际化,展示英文格式的日期。 + +2.点击“中文国际化”,将获取到的系统时间进行中文国际化,展示中文格式的日期。 + +3.点击“日文国际化”,将获取到的系统时间进行日文国际化,展示日文格式的日期。 + +### 约束与限制 + +本示例仅支持在标准系统上运行。 \ No newline at end of file diff --git a/UI/International/build.gradle b/UI/International/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..708d0f3df6dab533b167c46366653f960c48cac0 --- /dev/null +++ b/UI/International/build.gradle @@ -0,0 +1,34 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/UI/International/entry/build.gradle b/UI/International/entry/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6b6a606b1b3e2af76d27a6fa8ad069e92ddbed68 --- /dev/null +++ b/UI/International/entry/build.gradle @@ -0,0 +1,17 @@ +apply plugin: 'com.huawei.ohos.hap' + +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 6 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + supportSystem "standard" +} diff --git a/UI/International/entry/src/main/config.json b/UI/International/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..44e647ba844567d42cd0d1971dbd4cb180dfdf2e --- /dev/null +++ b/UI/International/entry/src/main/config.json @@ -0,0 +1,58 @@ +{ + "app": { + "bundleName": "ohos.samples.international", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.international", + "name": ".MyApplication", + "mainAbility": "ohos.samples.international.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "name": "ohos.samples.international.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "formsEnabled": false, + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/UI/International/entry/src/main/js/default/app.js b/UI/International/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..58d12b7b501fbf46db906a86187aaf18dfb1f677 --- /dev/null +++ b/UI/International/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 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. + */ + +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/UI/International/entry/src/main/js/default/i18n/en-US.json b/UI/International/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..0a775bbcdef4b59a6e2e5ff23fb24deeb0c65b24 --- /dev/null +++ b/UI/International/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "date": "System date", + "en": "English", + "cn": "Chinese", + "ja": "Japanese" + } +} \ No newline at end of file diff --git a/UI/International/entry/src/main/js/default/i18n/zh-CN.json b/UI/International/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..92e779de83458f88832b1fe8d20cf8560235fb3c --- /dev/null +++ b/UI/International/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,9 @@ +{ + "strings": { + "date": "系统日期", + "en": "英文国际化", + "cn": "中文国际化", + "ja": "日文国际化" + } + +} \ No newline at end of file diff --git a/UI/International/entry/src/main/js/default/pages/index/index.css b/UI/International/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..42aa5abe7c0e23473c8ec6c8981927f17330ad10 --- /dev/null +++ b/UI/International/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 30px; + text-align: center; + width: 50%; + border-color: black; + border-style: solid; + border-width: 1px; + height: 60px; +} + +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/UI/International/entry/src/main/js/default/pages/index/index.hml b/UI/International/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..a33fc9cf0ee2ba77780221f27c3f426756cc8218 --- /dev/null +++ b/UI/International/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,25 @@ + + +