# Swedish? meta just showed me the UI in Swedish

**URL:** <https://meta.discourse.org/t/swedish-meta-just-showed-me-the-ui-in-swedish/41137>\
**Category:** Bug\
**Created:** [2016年三月16日 13:59 UTC](https://meta.discourse.org/t/swedish-meta-just-showed-me-the-ui-in-swedish/41137 "2016-03-16T13:59:08Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2016年三月17日 20:59 UTC](https://meta.discourse.org/t/swedish-meta-just-showed-me-the-ui-in-swedish/41137/10 "2016-03-17T20:59:09Z")

</div>

> [@sam](#):
>
> every permutation out there of accept language will force a new entry in the cache.

It wouldn’t be as bad if a global setting was added _and_ the accept-language header was parsed before it was used in the cache\_key. Something like this?

```rb
# lib/anonymous_locale.rb

class AnonymousLocale
  def self.locale(accept_language_header)
    if GlobalSetting.locale_from_header
      begin
        require 'http_accept_language' unless defined? HttpAcceptLanguage
        available_locales = I18n.available_locales.map { |locale| locale.to_s.gsub(/_/, '-') }
        parser = HttpAcceptLanguage::Parser.new(accept_language_header)
        parser.language_region_compatible_from(available_locales).gsub(/-/, '_')
      rescue
        I18n.default_locale
      end
    else
      I18n.default_locale
    end
  end
end

```

And then in anonymous\_cache:

```rb
def cache_key
  @cache_key ||= "ANON_CACHE_#{@env["HTTP_ACCEPT"]}_#{AnonymousLocale.locale(@env["HTTP_ACCEPT_LANGUAGE"])}_#{@env["HTTP_HOST"]}#{@env["REQUEST_URI"]}|m=#{is_mobile?}|c=#{is_crawler?}"
end

```

---

_[View the full topic](https://meta.discourse.org/t/swedish-meta-just-showed-me-the-ui-in-swedish/41137)._
