<commit_before>var Mapbender = Mapbender || {};
Mapbender.transCallBack = function(objToCallBack, termsToTranslate) {
    var mb = this;
    $.ajax({
        url: mb.configuration.transPath,
        type: "post",
        data: termsToTranslate,
        dataType: "json",
        complete: function(jqXHR, textStatus) {
            if(textStatus == "success") {
                termsToTranslate = $.parseJSON(jqXHR.responseText);
            }
            objToCallBack.transCallBack(termsToTranslate);
        }
    });
};

Mapbender.strToHex = function(term) {
    var r="";
    var c=0;
    var h;
    while(c<term.length){
        h=term.charCodeAt(c++).toString(16);
        while(h.length<3) h="0"+h;
        r+=h;
    }
    return r;
//    return term.toLowerCase().replace(/[^a-z0-9]/g, "_");
};

Mapbender.termsToTranslate = function(terms) {
    var translatedterms = {};
    for(var i = 0; i < terms.length; i++) {
        translatedterms[this.strToHex(terms[i])] = terms[i];
    }
    return translatedterms;
};

Mapbender.getTrans = function(translatedterms, term) {
    var result = term;
    try {
        result = translatedterms[this.strToHex(term)];
    }catch(e){  }
    return result;
};
<commit_msg>js translation geändert<commit_after>var Mapbender = Mapbender || {};
Mapbender.transCallBack = function(objToCallBack, termsToTranslate, saveAtAll) {
    if(typeof(saveAtAll) === 'undefined'){
        saveAtAll = false;
    }
    if(typeof(Mapbender.alltranslations) !== 'undefined'){
        try {
            var result = {};
            for(var key in termsToTranslate){
                result[key] = Mapbender.alltranslations[key];
            }
            objToCallBack.transCallBack(result);
            return;
        }catch(e){}
    }
    var mb = this;
    $.ajax({
        url: mb.configuration.transPath,
        type: "post",
        data: termsToTranslate,
        dataType: "json",
        complete: function(jqXHR, textStatus) {
            if(textStatus == "success") {
                termsToTranslate = $.parseJSON(jqXHR.responseText);
                if(saveAtAll) {
                    if(typeof(Mapbender.alltranslations) === 'undefined'){
                        Mapbender.alltranslations = {};
                    }
                    for(var key in termsToTranslate){
                        Mapbender.alltranslations[key] = termsToTranslate[key];
                    }
                }
            }
            objToCallBack.transCallBack(termsToTranslate);
        }
    });
};

Mapbender.strToHex = function(term) {
    var r="";
    var c=0;
    var h;
    while(c<term.length){
        h=term.charCodeAt(c++).toString(16);
        while(h.length<3) h="0"+h;
        r+=h;
    }
    return r;
//    return term.toLowerCase().replace(/[^a-z0-9]/g, "_");
};

Mapbender.termsToTranslate = function(terms) {
    var translatedterms = {};
    for(var i = 0; i < terms.length; i++) {
        translatedterms[this.strToHex(terms[i])] = terms[i];
    }
    return translatedterms;
};

Mapbender.getTrans = function(translatedterms, term) {
    var result = term;
    try {
        result = translatedterms[this.strToHex(term)];
    }catch(e){  }
    return result;
};

Mapbender.getTransFromAll = function(term) {
    var result = term;
    try {
        result = Mapbender.alltranslations[this.strToHex(term)];
    }catch(e){  }
    return result;
};
{'fraction_non_alphanumeric': 0.14075382803297998, 'fraction_numerical': 0.004711425206124852, 'mean_word_length': 2.174766355140187, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2494718', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1077, 'n_words': 180}