Angular Translate不适用于阿拉伯语

时间:2017-01-17 12:11:31

标签: angularjs ionic-framework arabic

我正在使用Angular Translate库为Ionic应用程序制作多种语言。

它适用于英文字符,但对于阿拉伯语charachteres我得到像这样的问号

enter image description here

这是代码



// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
var app = angular.module('starter', ['ionic', 'pascalprecht.translate']);

app.run(function ($ionicPlatform) {
    $ionicPlatform.ready(function () {
        if (cordova.platformId === "ios" && window.cordova && window.cordova.plugins.Keyboard) {
            // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
            // for form inputs)
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

            // Don't remove this line unless you know what you are doing. It stops the viewport
            // from snapping when text inputs are focused. Ionic handles this internally for
            // a much nicer keyboard experience.
            cordova.plugins.Keyboard.disableScroll(true);
        }
        if (window.StatusBar) {
            StatusBar.styleDefault();
        }
    });
});



    app.config(function ($stateProvider, $urlRouterProvider, $translateProvider) {
        $translateProvider.translations('en', {
            hello_message: "Hello this is Itmam",
            goodbye_message: "Goodbye you were with Itmam"
        });
        $translateProvider.translations('ar', {
            hello_message: "مرحباً , هذه هي اتمام",
            goodbye_message: "مع السلامه , كنت مع اتمام"
        });
        $translateProvider.preferredLanguage("ar");
        $translateProvider.fallbackLanguage("en");

    });
&#13;
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!--For users deploying their apps to Windows 8.1 or Android Gingerbread, platformOverrided.js
    will inject platform-specific code from the /merges folder -->
    <script src="js/platformOverrides.js"></script>

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

      <script src="js/angular-translate.min.js"></script>
    <!-- your app's js -->
    <script src="js/app.js"></script>
  </head>
  <body ng-app="starter">

    <ion-pane>
      <ion-header-bar class="bar-stable">
        <h1 class="title">Switch Languages</h1>
      </ion-header-bar>
      <ion-content>
          <h1>{{"hello_message" | translate}}</h1>
          <h2>{{"goodbye_message" | translate}}</h2>
          <h2></h2>

      </ion-content>
    </ion-pane>
  </body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案