소스 검색

切换语言代码提交

hy 6 년 전
부모
커밋
ee056250f1
4개의 변경된 파일83개의 추가작업 그리고 17개의 파일을 삭제
  1. 43 13
      app.json
  2. 30 3
      app/view/main/Main.js
  3. 3 0
      app/view/main/Main.scss
  4. 7 1
      index.html

+ 43 - 13
app.json

@@ -221,24 +221,54 @@
 
     "builds": {
         //6.6默认主题 扁平风格
-        "triton": {
-            "theme": "theme-triton"
+        "triton_zh": {
+            "theme": "theme-triton",
+            "locale":"zh_CN"
+        },
+        "triton_en": {
+            "theme": "theme-triton",
+            "locale":"en-US"
         },
         //经典主题
-        "classic": {
-            "theme": "theme-classic"
+        "classic_zh": {
+            "theme": "theme-classic",
+            "locale":"zh_CN"
+        },
+        "classic_en": {
+            "theme": "theme-classic",
+            "locale":"en-US"
         }, 
-        "gray" : {
-            "theme" : "theme-gray"
+        "gray_zh" : {
+            "theme" : "theme-gray",
+            "locale":"zh_CN"
+        },
+        "gray_en" : {
+            "theme" : "theme-gray",
+            "locale":"en-US"
         },
-        "aria": {
-            "theme": "theme-aria"
-        },              
-        "neptune" : {
-            "theme": "theme-neptune"
+        "aria_zh": {
+            "theme": "theme-aria",
+            "locale":"zh_CN"
         },  
-        "crisp" :{
-            "theme": "theme-crisp"
+        "aria_en": {
+            "theme": "theme-aria",
+            "locale":"en-US"
+        },            
+        "neptune_zh" : {
+            "theme": "theme-neptune",
+            "locale":"zh_CN"
+        },
+        "neptune_en" : {
+            "theme": "theme-neptune",
+            "locale":"en-US"
+        },   
+        "crisp_zh" :{
+            "theme": "theme-crisp",
+            "locale":"zh_CN"
+        },
+        "crisp_en" :{
+            "theme": "theme-crisp",
+            "locale":"en-US"
         }
     },
     

+ 30 - 3
app/view/main/Main.js

@@ -25,10 +25,10 @@ Ext.define('uas.view.main.Main', {
             value:'<h2 style="margin-top: 7px;">UAS2.0组件库</h2>',
         },'->',{
             xtype:'combo',
-            width: 220,
-            labelWidth:80,
+            width: 210,
+            labelWidth:110,
             editable: false,
-            fieldLabel:'当前主题',
+            fieldLabel:'当前主题&语言',
             store: Ext.create('Ext.data.Store', {
                 fields: ['display', 'value'],
                 data : [
@@ -55,6 +55,33 @@ Ext.define('uas.view.main.Main', {
                     c.setValue(getCookie('theme'))
                 }
             }
+        },{
+            xtype:'combo',
+            width: 110,
+            labelWidth:0,
+            editable: false,
+            store: Ext.create('Ext.data.Store', {
+                fields: ['display', 'value'],
+                data : [
+                    {"display":"简体中文", "value": 'zh'},
+                    {"display":"英语", "value": 'en'}
+                ]
+            }),
+            cls:'x-desktop-combo2',
+            triggerAction: 'all',
+            forceSelection: true,
+            queryMode: 'local',
+            displayField: 'display',
+            valueField: 'value',
+            listeners: {
+                select: function(combo, records, obj){
+                    setCookie('locale',combo.value,0);
+                    window.location.reload();
+                },
+                beforerender:function(c){
+                    c.setValue(getCookie('locale'))
+                }
+            }
         }]
     },{
         region: 'west',

+ 3 - 0
app/view/main/Main.scss

@@ -1,3 +1,6 @@
 .x-desktop-combo{
+    margin: -10px 0px 0 0 !important;
+}
+.x-desktop-combo2{
     margin: -10px 20px 0 0 !important;
 }

+ 7 - 1
index.html

@@ -48,7 +48,13 @@
                 theme = 'triton';
             }
             console.log('加载系统主题方案:' + theme); 
-            Ext.manifest = theme + '.json'; }; 
+            var locale = getCookie('locale'); 
+            if(!locale){
+                setCookie('locale',"zh",0);
+                locale = 'zh';
+            }
+            console.log('加载语言包:' + theme); 
+            Ext.manifest = theme + '_' + locale + '.json'; }; 
     </script>
 
     <script id="microloader" data-app="87100719-3701-4a39-9b0f-ed5f99833426" type="text/javascript" src="bootstrap.js"></script>