WEUI与AngularJS 翻译

  • A+
所属分类:JavaScript MVC

WEUI与AngularJS 翻译

WEUI要js_show类

il8n文件夹下写json文件,文件名为option的value的值.json

  1. {    
  2.   "100049""預約就診",    
  3.   "100050""非紧急情况勿动"    
  4. }    

Html

  1. <!DOCTYPE html>    
  2. <html lang="en" ng-app="app">    
  3.     <head>    
  4.         <meta charset="UTF-8">    
  5.         <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">    
  6.         <title></title>    
  7.         <link rel="stylesheet" type="text/css" href="weui/dist/style/weui.min.css">    
  8.         <link rel="stylesheet" type="text/css" href="weui/dist/example/example.css">    
  9.     
  10.     </head>    
  11. <body>    
  12.  <div class="container" id="container"></div>    
  13.     
  14.     
  15.     
  16.     
  17. <img src="image/bg.png" width="100%" height="100%" style="z-index:-100;position:absolute;left:0;top:0">    
  18.     
  19.     
  20.   <select class="weui-select js_show" name="select1" ng-controller="LanguageSwitchingCtrl" ng-model="cur_lang" ng-change="switching(cur_lang)" id="select1">    
  21.                             <option value="cn" selected="selected">繁體中文</option>    
  22.                             <option value="riyu">日本语</option>    
  23.                             <option value="hanyu">한국어</option>    
  24.                             <option value="en">English</option>    
  25.                         </select>    
  26.     
  27.       <div class="page__bd js_show">    
  28.         <div class="weui-panel weui-panel_access">    
  29.                
  30.             <div class="weui-panel__bd">    
  31.                 <a href="yuyue.html" class="weui-media-box weui-media-box_appmsg">    
  32.                     <div class="weui-media-box__hd">    
  33.                        <img src="image/book_medicine_reportorium_72px_4019_easyicon.net.png" alt="" border="0" class="weui-media-box__thumb">    
  34.                     </div>    
  35.                     <div class="weui-media-box__bd">    
  36.                         <h4 class="weui-media-box__title"><strong><font face="Microsoft YaHei" >{{"100049" | translate}}</font></strong></h4>    
  37.                            
  38.                     </div>    
  39.                 </a>    
  40.                     
  41.     
  42.           </div>    
  43.                
  44.               
  45.                
  46.                
  47.         </div>    
  48.             
  49.         <div  style="width:128px;height:128px;position:fixed;top:58%;left:80px;right:80px;margin-top:-64px;margin- left:-64px;text-align:center;margin:0 auto;">    
  50.             
  51.          <a href="succes.html">     
  52.            <img src="image/SOS.png" alt="" border="0" class="weui-media-box__thumb" style="">    
  53.         </a>    
  54.          <p><font style="color:red;font-size:X-large">{{"100050" | translate}}!</font></p>    
  55.         </div>    
  56.             
  57.         
  58.             
  59.           </div>    
  60.               
  61.               
  62.     
  63.     
  64.             
  65.             
  66.             
  67.     
  68.     
  69.     
  70.     <script src="bower_components/angular/angular.min.js"></script>    
  71.     <script src="bower_components/angular-translate/angular-translate.min.js"></script>    
  72.     <script src="bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js"></script>    
  73.     <script src="bower_components/ionic-v1.3.2/js/angular/angular-sanitize.min.js"></script>    
  74.     
  75.     <script type="text/javascript">    
  76.             var lang;    
  77.             var app = angular.module("app", ['pascalprecht.translate']);    
  78.             app.config(['$translateProvider', function ($translateProvider) {    
  79.                 lang = window.localStorage.lang || 'en';    
  80.                 $translateProvider.useStaticFilesLoader({    
  81.                     prefix: 'il8n/',    
  82.                     suffix: '.json'    
  83.                 });    
  84.                 $translateProvider.preferredLanguage(lang);    
  85.     
  86.             }]);    
  87.     
  88.     
  89.     
  90.             angular.module('app').controller('LanguageSwitchingCtrl', ['$scope', '$translate', function (scope, $translate) {    
  91.                 scope.switching = function (lang) {    
  92.                     $translate.use(lang);    
  93.                     window.localStorage.lang = lang;    
  94.                     //window.location.reload();    
  95.                 };    
  96.                 scope.cur_lang = $translate.use();    
  97.     
  98.             }]);    
  99.     
  100.             angular.module("app").filter("T", ['$translate', function ($translate) {    
  101.                 return function (key) {    
  102.                     if (key) {    
  103.                         return $translate.instant(key);    
  104.                     }    
  105.                 };    
  106.             }]);    
  107.     
  108.     
  109.     </script>    
  110.               
  111. <script src="weui/dist/example/zepto.min.js"></script>    
  112. <script src="weui/dist/example/example.js"></script>    
  113. <script src="js/jweixin-1.0.0.js"></script>    
  114. </body>    
  115. </html>    
钰玺

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: