JS Interesting Facts About Country and Language Codes

Channel:
Subscribers:
838
Published on ● Video Link: https://www.youtube.com/watch?v=f2mLoSD1LBs



Duration: 0:00
1 views
0


OS and browser language settings are independent, and provide different information.

The OS language setting, retrieved via Intl package’s DateTimeFormat return value, resolvedOptions, and then locale, reflects the system language of Windows or macOS.

In contrast, the browser language setting, accessed through navigator dot language, depends on the browser's UI language.

Additionally, navigator dot languages returns the user’s preferred language list, and aligns with the Accept-Language header.

Country codes follow ISO three one six six dash one, while language codes adhere to ISO six three nine dash one, typically formatted in BCP four seven, such as en dash US or ja dash JP.

For web applications, using navigator dot languages ensures a more accurate language preference detection.

The establishment of country codes (ISO 3166) and language codes (ISO 639) has several interesting stories. For example, the two-letter code "CH" for Switzerland comes from its Latin name, "Confoederatio Helvetica". This choice was made because Switzerland has four official languages—German, French, Italian, and Romansh—so Latin was selected as a neutral alternative.

https://setapolo.github.io//PaMa/UserCountryDetection.html