html - Angular-translate not working with static json content -
angular translation works fine if symabol , translation provided inside $translateprovider.translations() . , when attempt perform translation value json file, translation not working .
var mymodel= angular.module('mymodel',['pascalprecht.translate']). config(function($translateprovider) { $translateprovider.translations('en', { headline: 'hello there, awesome app!', intro_text: 'and has i18n support!' }) .translations('de', { headline: 'hey, das ist meine großartige app!', intro_text: 'und sie untersützt mehrere sprachen!' }); $translateprovider.usestaticfilesloader({ prefix: 'https://localhost/angular%20seed/app/js/languages/', suffix: '.json' }); $translateprovider.preferredlanguage('de'); $translateprovider.fallbacklanguage('de'); // $translateprovider.uselocalstorage(); });
my html file is
<html ng-app="mymodel"> <head> <title> sing up</title> <link rel="stylesheet" href="css/bootstrap.min.css"/> <link rel="stylesheet" href="css/app.css"/> <script src="lib/angular/angular.js"></script> <script src="lib/angular/angular-resource.js"></script> <script src="lib/angular/angular-translate.js"></script> <script src="lib/angular/angular-translate-loader-static-files.js"></script> <script src="js/app.js"></script> <script src="js/controllers/firstcontroller.js"></script> </head> <body style="margin-left:200px"> <div ng-controller="firstcontroller"> {{ 'intro_text' | translate }} {{ 'intro_text1' | translate }} </div> </body> </html>
de.json (path : https://localhost/angular%20seed/app/js/languages/de.json
)
{ "headline1": "hey, das ist meine großartige app!", "intro_text1": "und sie untersützt mehrere sprachen!" }
output
und sie untersützt mehrere sprachen! intro_text1
edit i'm not receiving error message .
Comments
Post a Comment