Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 440ad8d3

Von Thomas Heck vor mehr als 11 Jahren hinzugefügt

  • ID 440ad8d3e9fada111bf174d11081c910c361acef
  • Vorgänger bc08036a
  • Nachfolger 3c416dd9

JS-Übersetzung immer in HEAD laden

Unterschiede anzeigen:

js/kivi.js
1 1
namespace("kivi", function(ns) {
2

  
3
  ns._localeLang = false;
4
  ns._locales = {};
2
  ns._locale = {};
5 3

  
6 4
  ns.t8 = function(text, params) {
7
    if( ns._localeLang ) {
8
      if( !ns._locales[ns._localeLang] ) {
9
        ns._locales[ns._localeLang] = {};
10

  
11
        jQuery.ajax({
12
          url: "js/locale/"+ ns._localeLang +".js",
13
          async: false,
14
          dataType: "json",
15
          success: function(res) {
16
            ns._locales[ns._localeLang] = res;
17
          },
18
        });
19
      }
20

  
21
      text = ns._locales[ns._localeLang][text] || text;
22
    }
5
    var text = ns._locale[text] || text;
23 6

  
24 7
    if( Object.prototype.toString.call( params ) === '[object Array]' ) {
25 8
      var len = params.length;
......
40 23
    return text;
41 24
  };
42 25

  
43
  ns.initLocale = function(localeLang) {
44
    ns._localeLang = localeLang;
26
  ns.setupLocale = function(locale) {
27
    ns._locale = locale;
45 28
  };
46

  
47 29
});
30

  
31
kivi = namespace('kivi');

Auch abrufbar als: Unified diff