angular-translate国际化

孟德曜
2023-12-01
1、<h1>{{"hello" | translate}}</h1>
2、<h1 ng-bind-html="'hello' | translate"></h1>
3、<span translate="hello"></span>

 1  <script src="~/Scripts/angular.min.js"></script>
 2  <script src="~/Scripts/angular-translate.min.js"></script>
 3  <script type="text/javascript">
 4   var app = angular.module("app", ['pascalprecht.translate']);
 5   app.config(['$translateProvider', function ($translateProvider) {
 6    $translateProvider.translations('zh-cn', {
 7     'hello': '你好',
 8    });
 9 
10    $translateProvider.preferredLanguage('zh-cn');
11   }]);
12  </script>
13 </head>
14 <body>
15  <h1>{{"hello" | translate}}</h1>
16 </body>

 

 



转载于:https://www.cnblogs.com/anyun/p/8359420.html

 类似资料: