Add change Language button.

This commit is contained in:
Myf 2015-10-30 15:53:40 +08:00
parent 62cab3ed7e
commit 1b7ee32037
2 changed files with 37 additions and 3 deletions

View File

@ -13,6 +13,7 @@
<link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/font-awesome.min.css"> <link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/flag-icon.min.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/download.css"> <link rel="stylesheet" href="css/download.css">
@ -74,6 +75,7 @@
<!-- translate --> <!-- translate -->
<script src="js/libs/angular-translate.js"></script> <script src="js/libs/angular-translate.js"></script>
<script src="js/translate/en_US.js"></script>
<script src="js/translate/th_TH.js"></script> <script src="js/translate/th_TH.js"></script>
<script src="js/translate/zh_CN.js"></script> <script src="js/translate/zh_CN.js"></script>
</head> </head>
@ -206,6 +208,34 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<ul class="nav navbar-nav">
<li class="dropdown" dropdown>
<a
href="#"
class="dropdown-toggle" dropdown-toggle>{{ 'Language' | translate }} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a
ng-click="changeLanguage('en_US')"
href="#"><span class="fa fa-fw flag-icon flag-icon-us">&nbsp;</span> English</a>
</li>
<li>
<a
ng-click="changeLanguage('th_TH')"
href="#"><span class="fa fa-fw flag-icon flag-icon-th">&nbsp;</span> Thai</a> <!-- TODO Thai translate -->
</li>
<li>
<a
ng-click="changeLanguage('zh_CN')"
href="#"><span class="fa fa-fw flag-icon flag-icon-cn">&nbsp;</span> 简体中文</a>
</li>
</ul>
</li>
</ul>
</div> </div>
<!-- }}} --> <!-- }}} -->

View File

@ -8,12 +8,12 @@ angular
'$scope', '$modals', '$scope', '$modals',
'$rpc', '$rpchelpers', '$fileSettings', '$rpc', '$rpchelpers', '$fileSettings',
'$globalSettings', '$globalExclude', '$globalSettings', '$globalExclude',
'$utils', '$utils', '$translate',
function( function(
scope, modals, scope, modals,
rpc, rhelpers, fsettings, rpc, rhelpers, fsettings,
gsettings, gexclude, gsettings, gexclude,
utils utils, translate
) { ) {
scope.isFeatureEnabled = function(f) { return rhelpers.isFeatureEnabled(f) }; scope.isFeatureEnabled = function(f) { return rhelpers.isFeatureEnabled(f) };
@ -131,6 +131,10 @@ angular
modals.invoke( modals.invoke(
'about' 'about'
); );
} };
scope.changeLanguage = function (langkey) {
translate.use(langkey);
};
}]); }]);