<commit_before>define('lyria/localization', ['lyria/language', 'lyria/template/string', 'lyria/mixin/language'], function(Language, templateString, langMixin) {

  var Localization = (function() {
    var Localization = function(data) {
      this.data = data;

      var langValue = Language.language;

      langMixin(this, langValue, this);
    };

    Localization.elements = function(localeData, localeLang, fallbackLang) {
      if (fallbackLang == null) {
        fallbackLang = 'en';
      }
      
      return function(name, parameter) {
        if (!localeData || Object.keys(localeData).length === 0) {
          return '[[No language data found]]';          
        }
        
        if (!localeData[localeLang] || Object.keys(localeData[localeLang]).length === 0) {
          localeLang = fallbackLang;
        }
        
        if (localeData[localeLang]) {
          
          if (localeData[localeLang][name] == null) {
            return '[[Missing localization for ' + name + ']]';
          }

          if ( typeof localeData[localeLang][name] === 'string') {
            return templateString.process(localeData[localeLang][name], parameter);
          } else {
            return {
              plural: function(n) {
                if (localeData[localeLang][name][n]) {
                  return templateString.process(localeData[localeLang][name][n], parameter);
                } else {
                  return templateString.process(localeData[localeLang][name]['n'], parameter);
                }
              }
            };
          }
        } else {
          return '[[No language definition found for ' + localeLang + ']]';
        }
      };
    };

    Localization.prototype.t = function() {
      return Localization.elements(this.data, this.language).apply(this, arguments);
    };

    return Localization;
  })();

  return Localization;
});<commit_msg>Added Localization#exists to check if a localization property does exist<commit_after>define('lyria/localization', ['lyria/language', 'lyria/template/string', 'lyria/mixin/language'], function(Language, templateString, langMixin) {

  var Localization = (function() {
    var Localization = function(data) {
      this.data = data;

      var langValue = Language.language;

      langMixin(this, langValue, this);
    };

    Localization.elements = function(localeData, localeLang, fallbackLang) {
      if (fallbackLang == null) {
        fallbackLang = 'en';
      }
      
      return function(name, parameter) {
        if (!localeData || Object.keys(localeData).length === 0) {
          return '[[No language data found]]';          
        }
        
        if (!localeData[localeLang] || Object.keys(localeData[localeLang]).length === 0) {
          localeLang = fallbackLang;
        }
        
        if (localeData[localeLang]) {
          
          if (localeData[localeLang][name] == null) {
            return '[[Missing localization for ' + name + ']]';
          }

          if ( typeof localeData[localeLang][name] === 'string') {
            return templateString.process(localeData[localeLang][name], parameter);
          } else {
            return {
              plural: function(n) {
                if (localeData[localeLang][name][n]) {
                  return templateString.process(localeData[localeLang][name][n], parameter);
                } else {
                  return templateString.process(localeData[localeLang][name]['n'], parameter);
                }
              }
            };
          }
        } else {
          return '[[No language definition found for ' + localeLang + ']]';
        }
      };
    };

    Localization.prototype.exists = function(name) {
      return (this.data && this.data[this.language] && this.data[this.language][name]);
    };

    Localization.prototype.t = function() {
      return Localization.elements(this.data, this.language).apply(this, arguments);
    };

    return Localization;
  })();

  return Localization;
});
{'fraction_non_alphanumeric': 0.1332835077229696, 'fraction_numerical': 0.000996512207274539, 'mean_word_length': 2.144087705559906, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3784728', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1052, 'n_words': 207}