<commit_before>package org.opencommercesearch.api

import play.api.mvc.Request
import play.api.i18n.Lang

/**
 * Some convenient i18n definitions
 * @author rmerizalde
 */
object I18n {
  val DefaultLang = Lang("en", "US")
  val SupportedLocales = Seq(DefaultLang, Lang("en", "CA"), Lang("en", "FR"))

  def language()(implicit request: Request[_]) = request.acceptLanguages.collectFirst({ case l if SupportedLocales.contains(l) => l}).getOrElse(DefaultLang)
}<commit_msg>Fix locale issue on product feeds<commit_after>package org.opencommercesearch.api

import play.api.mvc.Request
import play.api.i18n.Lang

/**
 * Some convenient i18n definitions
 * @author rmerizalde
 */
object I18n {
  val DefaultLang = Lang("en", "US")
  val SupportedLocales = Seq(DefaultLang, Lang("en", "CA"), Lang("fr", "CA"), Lang("en"), Lang("fr"))

  def language()(implicit request: Request[_]) = request.acceptLanguages.collectFirst({ case l if SupportedLocales.contains(l) => l}).getOrElse(DefaultLang)
}
{'fraction_non_alphanumeric': 0.15182186234817813, 'fraction_numerical': 0.012145748987854251, 'mean_word_length': 5.6824324324324325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2768698', 'n_tokens_mistral': 337, 'n_tokens_neox': 324, 'n_words': 77}