W3C I18N Techniques: Authoring XHTML & HTML
Language
This page lists links to resources on the W3C Internationalization Activity site and elsewhere that help you perform particular tasks. It is a subpage of the techniques index.
Using attributes to declare language
Best practices
How to's
-
Declaring Language in XHTML and HTML
W3C tutorial.
-
Using attributes to declare language
In W3C best practices document (Specifying Language in XHTML and HTML Content)
-
Declaring metadata about the language of the intended audience
In W3C best practices document (Specifying Language in XHTML and HTML Content)
Background reading
-
Why use the language attribute?
Why use the language attribute? A number of useful reasons.
Other references
-
Specifying the language of content: the lang attribute
lang attribute definition in HTML 4.01 (in HTML 4.01 spec, section 8.1)
-
xml:lang attribute definition in XML 1.0. (in XML 1.0 spec, section 2.12)
-
Clarify natural language usage
Express natural language in a document. (in Web Content Accessibility Guidelines, Guideline 4)
-
Identifying changes in language
Use lang attribute when language changes in a document (in Web Content Accessibility Techniques for HTML, section 2.1)
-
Identifying the primary language
Use lang attribute on html tag (in Web Content Accessibility Techniques for HTML, section 2.2)
-
The lang and xml:lang Attributes
xml:lang and lang attribute definitions in XHTML 1.0 (section C.7)
-
Content-Language definition in HTTP 1.1 (section 14.12)
-
Specifying the language of content: the lang attribute
HTML on Content-Language, only says that the HTML language attribute has a higher precedence (in HTML 4.01 spec, section 8.1)
Tests
-
Automatic font assignment for CJK text
W3C test page
-
Automatic font assignment for CJK text
W3C test results
-
W3C test page
-
Document-level language declaration
W3C test results
Declaring metadata about the language of the intended audience
Best practices
How to's
-
Declaring Language in XHTML and HTML
W3C tutorial.
-
Declaring metadata about the language of the intended audience
In W3C best practices document (Specifying Language in XHTML and HTML Content)
Background reading
-
Using HTTP and meta for language information
Should I declare the language of my XHTML document using a language attribute, the Content-Language HTTP header, or a Content-Language meta element? W3C article.
Other references
-
Content-Language in the HTTP1.1 specification (section 14.12)
-
Specifying the language of content: the lang attribute
Content-Language in the HTML specification: only says that the html language attribute has a higher precedence (section 8.1)
Declaring language for documents aimed at speakers of more than one language
How to's
-
Mechanisms for declaring language in HTML
In W3C best practices document (Specifying Language in XHTML and HTML Content)
-
Declaring Language in XHTML and HTML
W3C tutorial.
Background reading
-
Why use the language attribute?
A number of useful reasons. W3C article.
-
Using HTTP and meta for language information
Should I declare the language of my XHTML document using a language attribute, the Content-Language HTTP header, or a Content-Language meta element? W3C article.
Other references
-
Content-Language in the HTTP1.1 specification (section 14.12)
Choosing language values
Best practices
How to's
-
W3C best practices document (Specifying Language in XHTML and HTML Content)
-
How to choose the right attribute values. W3C article.
-
Specifying language tag values
W3C tutorial (Declaring Language in XHTML and HTML)
Particularly useful links
-
IANA's language tag registry.
-
Language Subtag Registry search tool
User friendly interface to IANA's language tag registry by Richard Ishida.
-
Points to a document containing both RFC 4646 (Tags for the Identification of Languages) and RFC 4647 (Matching Language Tags)
-
RFC 4646 Tags for the Identification of Languages
The specification.
-
RFC 4647 Matching of Language Tags
The specification.
Other references
-
Understanding the New Language Tags
Overview of RFC3066bis by one of its authors. W3C article.
-
Specifying the language of content: the lang attribute
lang in the HTML 4.01 spec (section 8.1)
-
xml:lang in the XML spec (section 2.12)
-
Two-letter or three-letter language codes
Should I use two-letter or three-letter ISO language codes in language tags? W3C article.
-
RFC 3066 Tags for the Identification of Languages
The previous IETF document that used to define how to use language tags to identify languages, now obsolete.
-
ISO 3166: Codes for Country Names
ISO country codes
-
ISO 639: Codes for the Representation of Names of Languages
ISO language codes
Test data
-
Automatic font assignment for CJK text
W3C test page
-
Automatic font assignment for CJK text
W3C test results
Identifying in-document language changes
Best practices
How to's
-
Using attributes to declare language
In W3C best practices document (Specifying Language in XHTML and HTML Content)
-
Declaring Language in XHTML and HTML
W3C tutorial.
-
Declaring metadata about the language of the intended audience
In W3C best practices document (Specifying Language in XHTML and HTML Content)
Background reading
-
Why use the language attribute?
Why use the language attribute? A number of useful reasons.
Other references
-
Specifying the language of content: the lang attribute
lang attribute definition in HTML 4.01 (in HTML 4.01 spec, section 8.1)
-
xml:lang attribute definition in XML 1.0. (in XML 1.0 spec, section 2.12)
-
Clarify natural language usage
Express natural language in a document. (in Web Content Accessibility Guidelines, Guideline 4)
-
Identifying changes in language
Use lang attribute when language changes in a document (in Web Content Accessibility Techniques for HTML, section 2.1)
-
The lang and xml:lang Attributes
xml:lang and lang attribute definitions in XHTML 1.0 (section C.7)
Indicating the language of a link destination
Best practices
How to's
-
How to indicate the language of a link destination
W3C best practices document (Specifying Language in XHTML & HTML Content)
-
The :before and :after pseudo-elements
:before and :after in the CSS 2.1 spec (section 12.1)
Other references
-
hreflang in the HTML spec (section 12.2)
Test data
-
W3C test page
-
W3C test results
Styling by language
How to's
-
Styling using the lang attribute
Compares :lang, lang |= and lang= selectors, and assesses current usability (W3C article)
Other references
-
The language pseudo-class :lang
CSS2 Specification (section 5.11.4)
-
CSS2 Specification (section 5.8)
-
CSS2 Specification (section 5.8.3)
-
CSS2 Specification (section 5.9)
Test data
-
W3C test page
-
W3C test results