Skip to content

Commit ab3d7ad

Browse files
committedMay 8, 2015
Add template.forceLanguage in apidoc.json to set a fixed language file without auto-detect.
1 parent 3baedf7 commit ab3d7ad

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

‎template/locales/locale.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ define([
2323

2424
var locale = (locales[langId] ? locales[langId] : locales[language]);
2525

26-
var __ = function(text) {
26+
function __(text) {
2727
var index = locale[text];
2828
if (index === undefined)
2929
return text;
3030
return index;
3131
};
3232

33+
function setLanguage(language) {
34+
locale = locales[language];
35+
}
36+
3337
return {
34-
__ : __,
35-
locales: locales,
36-
locale : locale
38+
__ : __,
39+
locales : locales,
40+
locale : locale,
41+
setLanguage: setLanguage
3742
};
3843
});

‎template/main.js

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ require([
7575
if (apiProject.template.withGenerator == null)
7676
apiProject.template.withGenerator = true;
7777

78+
if (apiProject.template.forceLanguage)
79+
locale.setLanguage(apiProject.template.forceLanguage);
80+
7881
// Setup jQuery Ajax
7982
$.ajaxSetup(apiProject.template.jQueryAjaxSetup);
8083

0 commit comments

Comments
 (0)
Please sign in to comment.