code: function sanitize(lang, filter) {
    if(!(typeof lang == 'string')) return lang;
    lang = lang.replace(/\..*$/, '').toLowerCase();
    if(typeof filter == 'function') {
      lang = filter(lang);
    }
    return lang;
  }
docs: Sanitize the value of an LC variable removing any character
  encoding portion, such that en_GB.UTF-8 becomes en_gb.
  
  @param lang A language identifier extracted from an LC variable.
  @param filter A filter function.
  
  @return A sanitized language identifier.