Set up I18N on preferences page & fix button label id - fixes #804

This commit is contained in:
Tom Morris 2013-09-04 15:13:55 -04:00
parent 819b577644
commit 82b764d06c
2 changed files with 21 additions and 2 deletions

View File

@ -494,8 +494,8 @@ function init() {
"externals/jquery-ui/jquery-ui-1.8.20.custom.min.js",
"externals/imgareaselect/jquery.imgareaselect.js",
"externals/date.js",
"scripts/preferences.js",
"externals/jquery.i18n.js",
"scripts/preferences.js",
]
);
ClientSideResourceManager.addPaths(

View File

@ -33,6 +33,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var preferenceUIs = [];
var lang = navigator.language.split("-")[0]
|| navigator.userLanguage.split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
type : "POST",
async : false,
data : {
module : "core",
//lang : lang
},
success : function(data) {
dictionary = data;
}
});
$.i18n.setDictionary(dictionary);
//End internationalization
function PreferenceUI(tr, key, value) {
var self = this;
@ -112,7 +131,7 @@ function populatePreferences(prefs) {
var tdLast0 = trLast.insertCell(0);
trLast.insertCell(1);
trLast.insertCell(2);
$('<button class="button">').text().appendTo(tdLast0).click(function() {
$('<button class="button">').text($.i18n._('core-index')["add-pref"]).appendTo(tdLast0).click(function() {
var key = window.prompt($.i18n._('core-index')["add-pref"]);
if (key) {
var value = window.prompt($.i18n._('core-index')["pref-key"]);