this.$translate.getTranslationTable("en-us") is working in my code but _this.$translate.setTranslation('en',{translateKey:_this.editFieldType.properties.labelName},true); is throwing an error
这个。$ translate.getTranslationTable(“en-us”)正在我的代码中工作但是_this。$ translate.setTranslation('en',{translateKey:_this.editFieldType.properties.labelName},true);抛出一个错误
1 个解决方案
#1
0
I think what you are looking for is the i18n for angular 1.5
我认为你所寻找的是角度为1.5的i18n
I use Angular Translate too to translate which is really useful and easy to use
我也使用Angular Translate进行翻译,这非常有用且易于使用
with just the below code you can get the i18n (and i10n too) to translate your angularjs app
只需以下代码,您就可以获得i18n(和i10n)来翻译您的angularjs应用程序
var app = angular.module('at', ['pascalprecht.translate']);
app.config(function ($translateProvider) {
$translateProvider.translations('en', {
TITLE: 'Hello',
FOO: 'This is a paragraph.',
BUTTON_LANG_EN: 'english',
BUTTON_LANG_DE: 'german'
});
$translateProvider.translations('de', {
TITLE: 'Hallo',
FOO: 'Dies ist ein Paragraph.',
BUTTON_LANG_EN: 'englisch',
BUTTON_LANG_DE: 'deutsch'
});
$translateProvider.preferredLanguage('en');
});
app.controller('Ctrl', function ($scope, $translate) {
$scope.changeLanguage = function (key) {
$translate.use(key);
};
});
I hope this is what you are looking for
我希望这就是你要找的东西
#1
0
I think what you are looking for is the i18n for angular 1.5
我认为你所寻找的是角度为1.5的i18n
I use Angular Translate too to translate which is really useful and easy to use
我也使用Angular Translate进行翻译,这非常有用且易于使用
with just the below code you can get the i18n (and i10n too) to translate your angularjs app
只需以下代码,您就可以获得i18n(和i10n)来翻译您的angularjs应用程序
var app = angular.module('at', ['pascalprecht.translate']);
app.config(function ($translateProvider) {
$translateProvider.translations('en', {
TITLE: 'Hello',
FOO: 'This is a paragraph.',
BUTTON_LANG_EN: 'english',
BUTTON_LANG_DE: 'german'
});
$translateProvider.translations('de', {
TITLE: 'Hallo',
FOO: 'Dies ist ein Paragraph.',
BUTTON_LANG_EN: 'englisch',
BUTTON_LANG_DE: 'deutsch'
});
$translateProvider.preferredLanguage('en');
});
app.controller('Ctrl', function ($scope, $translate) {
$scope.changeLanguage = function (key) {
$translate.use(key);
};
});
I hope this is what you are looking for
我希望这就是你要找的东西