【发布时间】:2016-02-22 15:38:08
【问题描述】:
我使用角度翻译静态文件加载器来翻译 html 中的内容。 我的代码在页面加载时工作正常,当我选择另一种未翻译的语言时,加载后以所选语言可见。
我的html代码是:
<select ng-model="selected" ng-options=" selec.Name for selec in langTable"> </select><br>
<span ng-bind-html="'world' |translate"></span>
我的角码是:
.config(function($translateProvider){
$translateProvider.useStaticFilesLoader({
prefix:'assets/',
suffix:'.STRINGS'
});
})
.controller( 'Ctrl', function ( $scope,$translate ) {
$scope.langTable=[{Name:'English',value:"en_US"},{Name:'France',value:"fr_FR"},{Name:'German',value:"pt_BR"}];
$scope.selected=$scope.langTable[1];
$translate.use($scope.selected.value);
console.log($scope.selected.value);
})
my en_US.STRINGS contains :
{
"world": "halooo worlde welcame to our new aPPP",
"hello":"haloo"
}
我所有的 .strings 文件都包含世界这个词!!
【问题讨论】:
标签: angularjs angular-translate angularjs-ng-options