Jump to content

Template:CURRENTCONTENTLANGUAGE/doc

From Meta, a Wikimedia project coordination wiki

Usage

[edit]

This template returns the "content language" of the current page; more precisely it checks if the current title ends with a language code, and if it is the case it returns this language code, else {{CONTENTLANGUAGE}} (the default content language; on this wiki: "en" for English). This results in poorer performance than the built-in {{PAGELANGUAGE}} magic word.

But it works on pages translated without the Translate extension, where the built-in magic word usually returns en even on translated versions.

Obsolete: please use {{PAGELANGUAGE}} magic word instead whenever possible, only on pages created with the translate tool.
Avoid the new magic keyword for generic widely used templates that can be transcluded in pages not prepared for the translate tool as this would break various local community pages.

Examples

[edit]
  • on "Bar/foo", this template returns "en";
  • on "Bar/foo/hu", this template returns "hu".

(Note: there could be false positive: e.g. on "Foo/bar" it returns "bar" because "bar" is the language code for Bavarian; "foo" is not a language code; very small (2 or 3 letters) last words can be a problem as seen here.)

This template takes no argument, and acts as a magic word. The similar magic word {{PAGELANGUAGE}} was requested in phab:T59603.