mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-06 23:18:03 +02:00
add angular-translate multilingual support
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
// Setting HTML5 Location Mode
|
||||
angular
|
||||
.module(app.applicationModuleName)
|
||||
.config(bootstrapConfig);
|
||||
.config(bootstrapConfig)
|
||||
.config(transConfig);
|
||||
|
||||
bootstrapConfig.$inject = ['$compileProvider', '$locationProvider', '$httpProvider', '$logProvider'];
|
||||
|
||||
@@ -26,6 +27,12 @@
|
||||
$logProvider.debugEnabled(app.applicationEnvironment !== 'production');
|
||||
}
|
||||
|
||||
transConfig.$inject = ['$translateProvider'];
|
||||
function transConfig($translateProvider) {
|
||||
$translateProvider.useSanitizeValueStrategy('escape');
|
||||
$translateProvider.preferredLanguage('en');
|
||||
//$translateProvider.fallbackLanguage('cn');
|
||||
}
|
||||
|
||||
// Then define the init function for starting up the application
|
||||
angular.element(document).ready(init);
|
||||
|
||||
@@ -13,7 +13,16 @@
|
||||
// **************************************************
|
||||
|
||||
var stringcn = {
|
||||
COMINGSOON: '开发中,请稍候...'
|
||||
COMINGSOON: '开发中,请稍候...',
|
||||
|
||||
//client menu
|
||||
SIGNOUT: '退出登录',
|
||||
SIGNIN: '登录',
|
||||
SIGNUP: '注册',
|
||||
EDIT_PROFILE: '修改个人信息',
|
||||
EDIT_PROFILE_PIC: '修改个人头像',
|
||||
CHANGE_PASSWORD: '修改登录密码',
|
||||
MANAGE_SOCIAL_ACCOUNTS: '管理社交帐号'
|
||||
};
|
||||
|
||||
// **************************************************
|
||||
@@ -23,7 +32,6 @@
|
||||
// config $translateProvider
|
||||
transConfig.$inject = ['$translateProvider'];
|
||||
function transConfig($translateProvider) {
|
||||
$translateProvider.useSanitizeValueStrategy('escape');
|
||||
$translateProvider.translations('cn', stringcn);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,16 @@
|
||||
// **************************************************
|
||||
|
||||
var stringen = {
|
||||
COMINGSOON: 'coming soon...'
|
||||
COMINGSOON: 'coming soon...',
|
||||
|
||||
//client menu
|
||||
SIGNOUT: 'Signout',
|
||||
SIGNIN: 'Sign In',
|
||||
SIGNUP: 'Sign Up',
|
||||
EDIT_PROFILE: 'Edit Profile',
|
||||
EDIT_PROFILE_PIC: 'Edit Profile Picture',
|
||||
CHANGE_PASSWORD: 'Change Password',
|
||||
MANAGE_SOCIAL_ACCOUNTS: 'Manage Social Accounts'
|
||||
};
|
||||
|
||||
// **************************************************
|
||||
@@ -24,8 +33,6 @@
|
||||
transConfig.$inject = ['$translateProvider'];
|
||||
function transConfig($translateProvider) {
|
||||
$translateProvider.translations('en', stringen);
|
||||
$translateProvider.preferredLanguage('cn');
|
||||
$translateProvider.fallbackLanguage('cn');
|
||||
}
|
||||
|
||||
}(ApplicationConfiguration));
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
.module('core')
|
||||
.run(menuConfig);
|
||||
|
||||
menuConfig.$inject = ['menuService'];
|
||||
menuConfig.$inject = ['menuService', '$translate', '$filter'];
|
||||
|
||||
function menuConfig(menuService) {
|
||||
function menuConfig(menuService, $translate) {
|
||||
menuService.addMenu('account', {
|
||||
roles: ['user']
|
||||
});
|
||||
@@ -20,22 +20,22 @@
|
||||
});
|
||||
|
||||
menuService.addSubMenuItem('account', 'settings', {
|
||||
title: 'Edit Profile',
|
||||
title: $translate.instant('EDIT_PROFILE'),
|
||||
state: 'settings.profile'
|
||||
});
|
||||
|
||||
menuService.addSubMenuItem('account', 'settings', {
|
||||
title: 'Edit Profile Picture',
|
||||
title: $translate.instant('EDIT_PROFILE_PIC'),
|
||||
state: 'settings.picture'
|
||||
});
|
||||
|
||||
menuService.addSubMenuItem('account', 'settings', {
|
||||
title: 'Change Password',
|
||||
title: $translate.instant('CHANGE_PASSWORD'),
|
||||
state: 'settings.password'
|
||||
});
|
||||
|
||||
menuService.addSubMenuItem('account', 'settings', {
|
||||
title: 'Manage Social Accounts',
|
||||
title: $translate.instant('MANAGE_SOCIAL_ACCOUNTS'),
|
||||
state: 'settings.accounts'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right" ng-hide="vm.authentication.user">
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="authentication.signup">Sign Up</a>
|
||||
<a ui-sref="authentication.signup">{{'SIGNUP' | translate}}</a>
|
||||
</li>
|
||||
<li class="divider-vertical"></li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="authentication.signin">Sign In</a>
|
||||
<a ui-sref="authentication.signin">{{'SIGNIN' | translate}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right" ng-show="vm.authentication.user">
|
||||
@@ -41,7 +41,7 @@
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href="/api/auth/signout" target="_self">Signout</a>
|
||||
<a href="/api/auth/signout" target="_self">{{'SIGNOUT' | translate}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user