<commit_before>#global $, _
((NS) ->
  # Filename: helpers/culture_helper.coffee
  "use strict"
  NS = NS or {}
  isInBrowser = typeof module is 'undefined' and typeof window isnt 'undefined'
  ArgumentNullException = if isInBrowser then NS.Helpers.Exceptions.ArgumentNullException else require("./custom_exception").ArgumentNullException
  ArgumentInvalidException= if isInBrowser then NS.Helpers.Exceptions.ArgumentInvalidException else require("./custom_exception").ArgumentInvalidException
  languagesOptions = {
    'fr-FR':{},
    'en-GB':{}
  }
  
  #Define or extend a language in the application.
  defineLanguage =(cultureCode, languageOptions, options) ->
    options = options or {}
    isExtend = options.isExtend or false
    if not cultureCode?
      throw new ArgumentNullException("cultureCode", cultureCode)
    if not _.isString(cultureCode)?
      throw new ArgumentInvalidException("cultureCode should be a string.", cultureCode)
    if not languageOptions?
      throw new ArgumentNullException("cultureCode", languageOptions)
    if not _.isObject(languageOptions)?
      throw new ArgumentInvalidException("languageOptions should be an object.", languageOptions)
    if(not isExtend or not languageOptions[cultureCode]?)
      languagesOptions[cultureCode] =  languageOptions
    else
      _.extend(languagesOptions[cultureCode], languageOptions)

  #Define many languages in the application.
  defineLanguages = (languages, options)->
    if not _.isArray(languages)
      throw new ArgumentInvalidException("Languages should be an array", languages)
    defineLanguage(language.culture, language.options) for language in languages
  
  # Get an array with all the application languages defined.
  getCultures = ->
    return _.keys(languagesOptions)
  
  # Get the language information.
  getLanguage = (cultureCode)->
    if languagesOptions[cultureCode]?
      return languagesOptions[cultureCode]
    return undefined

  mod = {
    "getCultures": getCultures,
    "defineLanguage": defineLanguage,
    "defineLanguages": defineLanguages,
    "getLanguage":getLanguage
  }
  if isInBrowser
    NS.Helpers = NS.Helpers or {}
    NS.Helpers.languageHelper = mod
  else
    module.exports = mod
)(if typeof module is 'undefined' and typeof window isnt 'undefined' then window.Fmk else module.exports)<commit_msg>#22 clean language helper module.<commit_after>#global $, _
# Filename: helpers/language_helper.coffee
"use strict"
NS = NS or {}
isInBrowser = typeof module is 'undefined' and typeof window isnt 'undefined'
ArgumentNullException = if isInBrowser then NS.Helpers.Exceptions.ArgumentNullException else require("./custom_exception").ArgumentNullException
ArgumentInvalidException= if isInBrowser then NS.Helpers.Exceptions.ArgumentInvalidException else require("./custom_exception").ArgumentInvalidException
languagesOptions = {
  'fr-FR':{},
  'en-GB':{}
}

#Define or extend a language in the application.
defineLanguage =(cultureCode, languageOptions, options) ->
  options = options or {}
  isExtend = options.isExtend or false
  if not cultureCode?
    throw new ArgumentNullException("cultureCode", cultureCode)
  if not _.isString(cultureCode)?
    throw new ArgumentInvalidException("cultureCode should be a string.", cultureCode)
  if not languageOptions?
    throw new ArgumentNullException("cultureCode", languageOptions)
  if not _.isObject(languageOptions)?
    throw new ArgumentInvalidException("languageOptions should be an object.", languageOptions)
  if(not isExtend or not languageOptions[cultureCode]?)
    languagesOptions[cultureCode] =  languageOptions
  else
    _.extend(languagesOptions[cultureCode], languageOptions)

#Define many languages in the application.
defineLanguages = (languages, options)->
  if not _.isArray(languages)
    throw new ArgumentInvalidException("Languages should be an array", languages)
  defineLanguage(language.culture, language.options) for language in languages

# Get an array with all the application languages defined.
getCultures = ->
  return _.keys(languagesOptions)

# Get the language information.
getLanguage = (cultureCode)->
  if languagesOptions[cultureCode]?
    return languagesOptions[cultureCode]
  return undefined

mod = {
  "getCultures": getCultures,
  "defineLanguage": defineLanguage,
  "defineLanguages": defineLanguages,
  "getLanguage":getLanguage
}
module.exports = mod
{'fraction_non_alphanumeric': 0.08701594533029612, 'fraction_numerical': 0.00045558086560364467, 'mean_word_length': 4.9177897574123985, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 12, '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': '503933', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1143, 'n_words': 346}