includes/clientside/static/l10n.js
changeset 583 c97d5f0d6636
parent 582 a38876c0793c
child 586 234ddd896555
equal deleted inserted replaced
582:a38876c0793c 583:c97d5f0d6636
     2  * Enano client-side localization library
     2  * Enano client-side localization library
     3  */
     3  */
     4 
     4 
     5 var Language = function(lang_id)
     5 var Language = function(lang_id)
     6 {
     6 {
     7   // load the language file
     7   var have_lang = false;
     8   load_show_win('strings');
     8   
     9   var ajax = ajaxMakeXHR();
     9   if ( typeof(enano_lang) == 'object' )
    10   var uri = makeUrlNS('Special', 'LangExportJSON/' + lang_id);
       
    11   ajax.open('GET', uri, false);
       
    12   ajax.send(null);
       
    13   if ( ajax.readyState == 4 && ajax.status == 200 )
       
    14   {
    10   {
    15     eval_global(ajax.responseText);
    11     if ( typeof(enano_lang[lang_id]) == 'object' )
       
    12     {
       
    13       have_lang = true;
       
    14     }
       
    15   }
       
    16   if ( !have_lang )
       
    17   {
       
    18     // load the language file
       
    19     load_show_win('strings');
       
    20     var ajax = ajaxMakeXHR();
       
    21     var uri = makeUrlNS('Special', 'LangExportJSON/' + lang_id);
       
    22     ajax.open('GET', uri, false);
       
    23     ajax.send(null);
       
    24     if ( ajax.readyState == 4 && ajax.status == 200 )
       
    25     {
       
    26       eval_global(ajax.responseText);
       
    27     }
    16   }
    28   }
    17   
    29   
    18   if ( typeof(enano_lang) != 'object' )
    30   if ( typeof(enano_lang) != 'object' )
    19     return false;
    31     return false;
    20   if ( typeof(enano_lang[lang_id]) != 'object' )
    32   if ( typeof(enano_lang[lang_id]) != 'object' )