When using country and language codes in a URL, which goes first?

6,612

Solution 1

The typical format for a locale is comprised of the two letter language code followed by the two letter country code. For example, here is a list of all the locales supported by Java:

Language                       Country               Locale ID
--------------------------------------------------------------
Albanian                       Albania               sq_AL
Arabic                         Algeria               ar_DZ
Arabic                         Bahrain               ar_BH
Arabic                         Egypt                 ar_EG
Arabic                         Iraq                  ar_IQ
Arabic                         Jordan                ar_JO
Arabic                         Kuwait                ar_KW
Arabic                         Lebanon               ar_LB
Arabic                         Libya                 ar_LY
Arabic                         Morocco               ar_MA
Arabic                         Oman                  ar_OM
Arabic                         Qatar                 ar_QA
Arabic                         Saudi Arabia          ar_SA
Arabic                         Sudan                 ar_SD
Arabic                         Syria                 ar_SY
Arabic                         Tunisia               ar_TN
Arabic                         United Arab Emirates  ar_AE
Arabic                         Yemen                 ar_YE
Belarusian                     Belarus               be_BY
Bulgarian                      Bulgaria              bg_BG
Catalan                        Spain                 ca_ES
Chinese (Simplified)           China                 zh_CN
Chinese (Simplified)           Singapore             zh_SG
Chinese (Traditional)          Hong Kong             zh_HK
Chinese (Traditional)          Taiwan                zh_TW
Croatian                       Croatia               hr_HR
Czech                          Czech Republic        cs_CZ
Danish                         Denmark               da_DK
Dutch                          Belgium               nl_BE
Dutch                          Netherlands           nl_NL
English                        Australia             en_AU
English                        Canada                en_CA
English                        India                 en_IN
English                        Ireland               en_IE
English                        Malta                 en_MT
English                        New Zealand           en_NZ
English                        Philippines           en_PH
English                        Singapore             en_SG
English                        South Africa          en_ZA
English                        United Kingdom        en_GB
English                        United States         en_US
Estonian                       Estonia               et_EE
Finnish                        Finland               fi_FI
French                         Belgium               fr_BE
French                         Canada                fr_CA
French                         France                fr_FR
French                         Luxembourg            fr_LU
French                         Switzerland           fr_CH
German                         Austria               de_AT
German                         Germany               de_DE
German                         Luxembourg            de_LU
German                         Switzerland           de_CH
Greek                          Cyprus                el_CY
Greek                          Greece                el_GR
Hebrew                         Israel                iw_IL
Hindi                          India                 hi_IN
Hungarian                      Hungary               hu_HU
Icelandic                      Iceland               is_IS
Indonesian                     Indonesia             in_ID
Irish                          Ireland               ga_IE
Italian                        Italy                 it_IT
Italian                        Switzerland           it_CH
Japanese (Gregorian calendar)  Japan                 ja_JP
Japanese (Imperial calendar)   Japan                 ja_JP_JP
Korean                         South Korea           ko_KR
Latvian                        Latvia                lv_LV
Lithuanian                     Lithuania             lt_LT
Macedonian                     Macedonia             mk_MK
Malay                          Malaysia              ms_MY
Maltese                        Malta                 mt_MT
...

When used on the web, the W3C recommends using a dash rather than an underscore as the canonical form. That document still shows examples with the capitalized language identifier as canonical, but specifies that all lowercase would match. For the purposes of URLs, I would use all lower case with a hyphen.

Solution 2

This is the language which dominates because there are many countries which use the same language. That's why, you need to specify to language first and then precise with the country.

Thus, the most appropriate is http://www.example.com/en-in/.

However, there is no impact on SEO, it's just a standard.

For this kind of stuff, you can just take a look how big companies do. For instance, Facebook has URLs like:

  • https://fr-ca.facebook.com (for Canadians who speak French)
  • https://fr-fr.facebook.com (for French people who speak French)
  • https://pt-br.facebook.com (for Brazilians who speak Portuguese)
  • https://pt-pt.facebook.com (for Portuguese people who speak Portuguese)
Share:
6,612

Related videos on Youtube

Barney
Author by

Barney

Updated on September 18, 2022

Comments

  • Barney
    Barney over 1 year

    When running multiple international Websites, is the best practice in language tags to specify firstly the language code then the country code, or vice versa?

    For instance:

    • http://www.example.com/en-in/ (English, India) or
    • https://www.example.com/in-en/