Search code examples
urllocalizationlocale

Standard for specifying Locale in the URL


Is there a standard for specifying the Locale (Country+Language) in the URL. I have seen:

  1. example.com/fr-fr/page
  2. example.com/page?locale=fr-fr
  3. fr.example.com/page
  4. example.com/page^fr_fr

Solution

  • I'm not sure if there's a standard in place, this is usually free of choice and depending on the project scope. I think it matters more to put the language first because many countries use the same language. So you specify the language first and then the 'region' to narrow down.

    Answering the following questions can help choosing the format:

    • do you need to support multi-languages per country (ex. dutch in belgium: nl/be & dutch in the Netherlands: nl/nl) ? This is usually when you need to track analytics per country/language.
    • do you just need to support the main languages (en, de, fr, es, pt, jp,...) and not care about the regions ?
    • does SEO matter ?
    • what looks better visually ?

    I usually go by www.url.com/{LANG}/{COUNTRY}/ or www.url.com/{LANG}-{COUNTRY}/