Manngo
Manngo

Reputation: 16369

HTML lang attribute: what is the role of the locale?

I am aware of the role of the lang attribute as indicating to relevant software the language of the page or section.

Some languages also include the possibility of a locale. In my case it would be something like <html lang="en-au"> to indicate English in Australia.

I have read:

What is lang attribute of the <html> tag used for?

but it doesn’t mention locale at all, let alone explain it.

The question is, how is the locale used, if at all?

Upvotes: 2

Views: 15308

Answers (2)

c-smile
c-smile

Reputation: 27470

Ideally, this, for example:

<input type="date" lang="en-AU" /> 

will configure the input to show dates in the way it is acceptable in Australia. Which is different from, say, Canada that also uses English.

And that's the answer.

Upvotes: 4

Moin Zaman
Moin Zaman

Reputation: 25455

W3C spec on language and locale identifiers: https://www.w3.org/TR/ltli/

IETF spec on the make up of the attribute: http://www.ietf.org/rfc/rfc3066.txt

It's system / platform / OS / user specific and based on what technology / language you're using, there are ways to determine it and it's usage.

For e.g.

apple / iOS: https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/InternationalizingLocaleData/InternationalizingLocaleData.html

Oracle: https://docs.oracle.com/cd/E23824_01/html/E26033/glmbx.html

Upvotes: 1

Related Questions