X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.I18n.js;h=eefef4d4e1e8342c9264de12def0a5ff3c83b173;hp=435d9ed94c458a56753b0b126ad6e41adcd3d1fe;hb=refs%2Fheads%2Fwip_edward_T5851_download_old_offer_sheet;hpb=12895e184db7cb0298f195f9557e39fbf67d24dc diff --git a/Pman.I18n.js b/Pman.I18n.js index 435d9ed9..eefef4d4 100644 --- a/Pman.I18n.js +++ b/Pman.I18n.js @@ -47,11 +47,17 @@ Pman.I18n = { toName: function(type, code) { var ret = code; - var lang = Pman.Login.authUser.lang || 'en'; + + var lang = 'en'; + + if(typeof(Pman.Login) != 'undefined' && typeof(Pman.Login.authUser.lang) == 'undefined'){ + lang = Pman.Login.authUser.lang; + } + if (code.indexOf('_') > -1) { var clang = code.split('_').shift(); var cc = code.split('_').pop(); - return this.toName('l', clang.toUpperCase()) + ' (' + this.toName('c', cc.toUpperCase()) + ')'; + return this.toName('l', clang.toLowerCase()) + ' (' + this.toName('c', cc.toUpperCase()) + ')'; } @@ -163,8 +169,8 @@ Pman.I18n = { }); ret = ret.sort(function(a,b) { - if (a[0] == '**') return 1; // other always at end.. - if (b[0] == '**') return -1; // other always at end.. + if (a[0] == '**') { return 1; } // other always at end.. + if (b[0] == '**') { return -1; } // other always at end.. return a[1] > b[1] ? 1 : -1; });