twt 2 月之前
父节点
当前提交
a3a5cad97c

+ 24 - 0
locale/en.json

@@ -0,0 +1,24 @@
+{
+  "locale.auto": "System",
+  "locale.en": "English",
+  "locale.zh-hans": "简体中文",
+  "locale.zh-hant": "繁体中文",
+  "locale.ja": "日语",
+  "index.title": "Hello i18n",
+  "index.home": "Home",
+  "index.component": "Component",
+  "index.api": "API",
+  "index.schema": "Schema",
+  "index.demo": "uni-app globalization",
+  "index.demo-description": "Include uni-framework, manifest.json, pages.json, tabbar, Page, Component, API, Schema",
+  "index.detail": "Detail",
+  "index.language": "Language",
+  "index.language-info": "Settings",
+  "index.system-language": "System language",
+  "index.application-language": "Application language",
+  "index.language-change-confirm": "Applying this setting will restart the app",
+  "api.message": "Message",
+  "schema.name": "Name",
+  "schema.add": "Add",
+  "schema.add-success": "Add success"
+}

+ 10 - 0
locale/index.js

@@ -0,0 +1,10 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+import ja from './ja.json'
+export default {
+	en,
+	'zh-Hans': zhHans,
+	'zh-Hant': zhHant,
+	ja
+}

+ 23 - 0
locale/ja.json

@@ -0,0 +1,23 @@
+{
+  "locale.auto": "システム",
+  "locale.en": "英語",
+  "locale.zh-hans": "简体中文",
+  "locale.zh-hant": "繁体中文",
+  "locale.ja": "日语",
+  "index.title": "Hello i18n",
+  "index.home": "ホーム",
+  "index.component": "コンポーネント",
+  "index.api": "API",
+  "index.schema": "Schema",
+  "index.demo": "uni-app globalization",
+  "index.demo-description": "ユニフレームワーク、manifest.json、pages.json、タブバー、ページ、コンポーネント、APIを含める、Schema",
+  "index.detail": "詳細",
+  "index.language": "言語",
+  "index.language-info": "設定",
+  "index.system-language": "システム言語",
+  "index.application-language": "アプリケーション言語",
+  "index.language-change-confirm": "この設定を適用すると、アプリが再起動します",
+  "api.message": "メッセージ",
+  "schema.add": "追加",
+  "schema.add-success": "成功を追加"
+}

+ 36 - 0
locale/uni-app.ja.json

@@ -0,0 +1,36 @@
+{
+  "common": {
+    "uni.app.quit": "もう一度押すと、アプリケーションが終了します",
+    "uni.async.error": "サーバーへの接続がタイムアウトしました。画面をクリックして再試行してください",
+    "uni.showActionSheet.cancel": "キャンセル",
+    "uni.showToast.unpaired": "使用するには、showToastとhideToastをペアにする必要があることに注意してください",
+    "uni.showLoading.unpaired": "使用するには、showLoadingとhideLoadingをペアにする必要があることに注意してください",
+    "uni.showModal.cancel": "キャンセル",
+    "uni.showModal.confirm": "OK",
+    "uni.chooseImage.cancel": "キャンセル",
+    "uni.chooseImage.sourceType.album": "アルバムから選択",
+    "uni.chooseImage.sourceType.camera": "カメラ",
+    "uni.chooseVideo.cancel": "キャンセル",
+    "uni.chooseVideo.sourceType.album": "アルバムから選択",
+    "uni.chooseVideo.sourceType.camera": "カメラ",
+    "uni.previewImage.cancel": "キャンセル",
+    "uni.previewImage.button.save": "画像を保存",
+    "uni.previewImage.save.success": "画像をアルバムに正常に保存します",
+    "uni.previewImage.save.fail": "画像をアルバムに保存できませんでした",
+    "uni.setClipboardData.success": "コンテンツがコピーされました",
+    "uni.scanCode.title": "スキャンコード",
+    "uni.scanCode.album": "アルバム",
+    "uni.scanCode.fail": "認識に失敗しました",
+    "uni.scanCode.flash.on": "タッチして点灯",
+    "uni.scanCode.flash.off": "タップして閉じる",
+    "uni.startSoterAuthentication.authContent": "指紋認識...",
+    "uni.picker.done": "完了",
+    "uni.picker.cancel": "キャンセル",
+    "uni.video.danmu": "「弾幕」",
+    "uni.video.volume": "ボリューム",
+    "uni.button.feedback.title": "質問のフィードバック",
+    "uni.button.feedback.send": "送信"
+  },
+  "ios": {},
+  "android": {}
+}

+ 24 - 0
locale/zh-Hans.json

@@ -0,0 +1,24 @@
+{
+	"locale.auto": "系统",
+	"locale.en": "English",
+	"locale.zh-hans": "简体中文",
+	"locale.zh-hant": "繁体中文",
+	"locale.ja": "日语",
+	"index.title": "Hello i18n",
+	"index.home": "主页",
+	"index.component": "组件",
+	"index.api": "API",
+	"index.schema": "Schema",
+	"index.demo": "uni-app 国际化演示",
+	"index.demo-description": "包含 uni-framework、manifest.json、pages.json、tabbar、页面、组件、API、Schema",
+	"index.detail": "详情",
+	"index.language": "语言",
+	"index.language-info": "语言信息",
+	"index.system-language": "系统语言",
+	"index.application-language": "应用语言",
+	"index.language-change-confirm": "应用此设置将重启App",
+	"api.message": "提示",
+  "schema.name": "姓名",
+	"schema.add": "新增",
+	"schema.add-success": "新增成功"
+}

+ 24 - 0
locale/zh-Hant.json

@@ -0,0 +1,24 @@
+{
+  "locale.auto": "系統",
+  "locale.en": "English",
+  "locale.zh-hans": "简体中文",
+  "locale.zh-hant": "繁體中文",
+  "locale.ja": "日语",
+  "index.title": "Hello i18n",
+  "index.home": "主頁",
+  "index.component": "組件",
+  "index.api": "API",
+  "index.schema": "Schema",
+  "index.demo": "uni-app 國際化演示",
+  "index.demo-description": "包含 uni-framework、manifest.json、pages.json、tabbar、頁面、組件、API、Schema",
+  "index.detail": "詳情",
+  "index.language": "語言",
+  "index.language-info": "語言信息",
+  "index.system-language": "系統語言",
+  "index.application-language": "應用語言",
+  "index.language-change-confirm": "應用此設置將重啟App",
+  "api.message": "提示",
+  "schema.name": "姓名",
+  "schema.add": "新增",
+  "schema.add-success": "新增成功"
+}

+ 12 - 0
main.js

@@ -1,5 +1,10 @@
 import App from './App'
+import messages from './locale/index'
 
+let i18nConfig = {
+  locale: uni.getLocale(),
+  messages
+}
 import common from '@/utils/common.js'
 Vue.prototype.$common =common
 
@@ -44,7 +49,11 @@ if(common.getHashQuery('quanxian')){
 import Vue from 'vue'
 Vue.config.productionTip = false
 App.mpType = 'app'
+import VueI18n from 'vue-i18n'
+Vue.use(VueI18n)
+const i18n = new VueI18n(i18nConfig)
 const app = new Vue({
+	 i18n,
     ...App
 })
 app.$mount()
@@ -52,8 +61,11 @@ app.$mount()
 
 // #ifdef VUE3
 import { createSSRApp } from 'vue'
+mport { createI18n } from 'vue-i18n'
+const i18n = createI18n(i18nConfig)
 export function createApp() {
   const app = createSSRApp(App)
+  app.use(i18n)
   return {
     app
   }

+ 49 - 0
package-lock.json

@@ -0,0 +1,49 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "@intlify/core-base": {
+      "version": "11.1.11",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/@intlify/core-base/-/core-base-11.1.11.tgz",
+      "integrity": "sha512-1Z0N8jTfkcD2Luq9HNZt+GmjpFe4/4PpZF3AOzoO1u5PTtSuXZcfhwBatywbfE2ieB/B5QHIoOFmCXY2jqVKEQ==",
+      "requires": {
+        "@intlify/message-compiler": "11.1.11",
+        "@intlify/shared": "11.1.11"
+      }
+    },
+    "@intlify/message-compiler": {
+      "version": "11.1.11",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/@intlify/message-compiler/-/message-compiler-11.1.11.tgz",
+      "integrity": "sha512-7PC6neomoc/z7a8JRjPBbu0T2TzR2MQuY5kn2e049MP7+o32Ve7O8husylkA7K9fQRe4iNXZWTPnDJ6vZdtS1Q==",
+      "requires": {
+        "@intlify/shared": "11.1.11",
+        "source-map-js": "^1.0.2"
+      }
+    },
+    "@intlify/shared": {
+      "version": "11.1.11",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/@intlify/shared/-/shared-11.1.11.tgz",
+      "integrity": "sha512-RIBFTIqxZSsxUqlcyoR7iiC632bq7kkOwYvZlvcVObHfrF4NhuKc4FKvu8iPCrEO+e3XsY7/UVpfgzg+M7ETzA=="
+    },
+    "@vue/devtools-api": {
+      "version": "6.6.4",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/@vue/devtools-api/-/devtools-api-6.6.4.tgz",
+      "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="
+    },
+    "source-map-js": {
+      "version": "1.2.1",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/source-map-js/-/source-map-js-1.2.1.tgz",
+      "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="
+    },
+    "vue-i18n": {
+      "version": "11.1.11",
+      "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-i18n/-/vue-i18n-11.1.11.tgz",
+      "integrity": "sha512-LvyteQoXeQiuILbzqv13LbyBna/TEv2Ha+4ZWK2AwGHUzZ8+IBaZS0TJkCgn5izSPLcgZwXy9yyTrewCb2u/MA==",
+      "requires": {
+        "@intlify/core-base": "11.1.11",
+        "@intlify/shared": "11.1.11",
+        "@vue/devtools-api": "^6.5.0"
+      }
+    }
+  }
+}

+ 45 - 0
pages/index/index.vue

@@ -8,6 +8,11 @@
 			{{longitude}}-----{{latitude}}
 		</view>
 		<view @click="goRemind">客户提醒</view>
+		<view class="title">{{$t('index.demo')}}</view>
+		<view class="locale-item" v-for="(item, index) in locales" :key="index" @click="onLocaleChange(item)">
+		  <text class="text">{{item.text}}</text>
+		  <text class="icon-check" v-if="item.code == applicationLocale"></text>
+		</view>
 	</view>
 </template>
 
@@ -19,8 +24,33 @@
 				androidData:'',
 				latitude:'',
 				longitude:'',
+				
 			}
 		},
+		computed:{
+		  locales() {
+		    return [{
+		        text: this.$t('locale.auto'),
+		        code: 'auto'
+		      }, {
+		        text: this.$t('locale.en'),
+		        code: 'en'
+		      },
+		      {
+		        text: this.$t('locale.zh-hans'),
+		        code: 'zh-Hans'
+		      },
+		      {
+		        text: this.$t('locale.zh-hant'),
+		        code: 'zh-Hant'
+		      },
+		      {
+		        text: this.$t('locale.ja'),
+		        code: 'ja'
+		      }
+		    ]
+		  }
+		},
 		onLoad() {
           window.getAndroid=this.getAndroid;
 		//  setTimeout( this.getAndroid(),500)
@@ -45,6 +75,21 @@
 			
 		},
 		methods: {
+			onLocaleChange(e) {
+			  if (this.isAndroid) {
+			    uni.showModal({
+			      content: this.$t('index.language-change-confirm'),
+			      success: (res) => {
+			        if (res.confirm) {
+			          uni.setLocale(e.code);
+			        }
+			      }
+			    })
+			  } else {
+			    uni.setLocale(e.code);
+			    this.$i18n.locale = e.code;
+			  }
+			},
 			goRemind(){
 				uni.navigateTo({
 					url:'../remind/index'

+ 0 - 0
uni_modules/no-data/changelog.md


+ 3 - 0
uni_modules/no-data/components/no-data/i18n/en.json

@@ -0,0 +1,3 @@
+{
+	"no-data.title": "No Data"
+}

+ 10 - 0
uni_modules/no-data/components/no-data/i18n/index.js

@@ -0,0 +1,10 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+import ja from './ja.json'
+export default {
+  en,
+  'zh-Hans': zhHans,
+  'zh-Hant': zhHant,
+  ja
+}

+ 3 - 0
uni_modules/no-data/components/no-data/i18n/ja.json

@@ -0,0 +1,3 @@
+{
+	"no-data.title": "データなし"
+}

+ 3 - 0
uni_modules/no-data/components/no-data/i18n/zh-Hans.json

@@ -0,0 +1,3 @@
+{
+	"no-data.title": "无数据"
+}

+ 3 - 0
uni_modules/no-data/components/no-data/i18n/zh-Hant.json

@@ -0,0 +1,3 @@
+{
+  "no-data.title": "無數據"
+}

+ 44 - 0
uni_modules/no-data/components/no-data/no-data.vue

@@ -0,0 +1,44 @@
+<template>
+  <view class="content">
+    <text class="message">{{title}}</text>
+  </view>
+</template>
+<script>
+  import {
+    initVueI18n
+  } from '@dcloudio/uni-i18n'
+  import messages from './i18n/index.js'
+  const {
+    t
+  } = initVueI18n(messages)
+
+  export default {
+    name: 'no-data',
+    props: {},
+    data() {
+      return {
+        title: t('no-data.title')
+      }
+    },
+    created(e) {},
+    // #ifndef VUE3
+    destroyed() {},
+    // #endif
+    // #ifdef VUE3
+    unmounted() {},
+    // #endif
+    methods: {}
+  }
+</script>
+
+<style lang="scss" scoped>
+  .content {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .message {
+    opacity: .8;
+  }
+</style>

+ 80 - 0
uni_modules/no-data/package.json

@@ -0,0 +1,80 @@
+{
+  "id": "no-data",
+  "displayName": "no-data",
+  "version": "1.0.0",
+  "description": "no-data",
+  "keywords": [
+    "no-data"
+],
+  "repository": "",
+  "engines": {
+    "HBuilderX": "^3.1.0"
+  },
+  "dcloudext": {
+    "category": [
+        "前端组件",
+        "通用组件"
+    ],
+    "sale": {
+      "regular": {
+        "price": "0.00"
+      },
+      "sourcecode": {
+        "price": "0.00"
+      }
+    },
+    "contact": {
+      "qq": ""
+    },
+    "declaration": {
+      "ads": "",
+      "data": "",
+      "permissions": ""
+    },
+    "npmurl": ""
+  },
+  "uni_modules": {
+    "dependencies": [],
+    "encrypt": [],
+    "platforms": {
+      "cloud": {
+        "tcb": "u",
+        "aliyun": "u"
+      },
+      "client": {
+        "Vue": {
+          "vue2": "u",
+          "vue3": "u"
+        },
+        "App": {
+          "app-vue": "u",
+          "app-nvue": "u"
+        },
+        "H5-mobile": {
+          "Safari": "u",
+          "Android Browser": "u",
+          "微信浏览器(Android)": "u",
+          "QQ浏览器(Android)": "u"
+        },
+        "H5-pc": {
+          "Chrome": "u",
+          "IE": "u",
+          "Edge": "u",
+          "Firefox": "u",
+          "Safari": "u"
+        },
+        "小程序": {
+          "微信": "u",
+          "阿里": "u",
+          "百度": "u",
+          "字节跳动": "u",
+          "QQ": "u"
+        },
+        "快应用": {
+          "华为": "u",
+          "联盟": "u"
+        }
+      }
+    }
+  }
+}

+ 1 - 0
uni_modules/no-data/readme.md

@@ -0,0 +1 @@
+# no-data