Template:Check ISO 639-1

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]

This template tests input for compatibility with ISO 639-1 language codes. ISO 639-1 codes are two-letter language codes; for example, English has the code "en" and Japanese has the code "ja".

The template accepts one input: the first positional parameter. If the input is a valid ISO 639-1 code, or if the input is a language name known to MediaWiki that can be converted to a valid ISO 639-1 code, the template outputs that code in lower case. Otherwise, it outputs an error message and adds the page to Category:Pages with invalid ISO 639-1 language codes. If you don't want to categorise pages you can use the |nocat= parameter.

A list of valid codes is available at List of ISO 639-1 codes.

Usage[edit]

Basic usage
{{Check ISO 639-1|code}}
Suppress categories
{{Check ISO 639-1|code|nocat=true}}

To suppress categories, the |nocat= parameter will accept any of "true", "yes", "y", or "1".

Examples[edit]

  • {{Check ISO 639-1|en}} → en
  • {{Check ISO 639-1|EN}} → en
  • {{Check ISO 639-1|eng}}Error: invalid input "eng"; please use an ISO 639-1 code
  • {{Check ISO 639-1|English}} → en
  • {{Check ISO 639-1|de}} → de
  • {{Check ISO 639-1|German}} → de
  • {{Check ISO 639-1|Deutsch}}Error: invalid input "Deutsch"; please use an ISO 639-1 code
  • {{Check ISO 639-1|en/fr}}Error: invalid input "en/fr"; please use an ISO 639-1 code
  • {{Check ISO 639-1|English and French}}Error: invalid input "English and French"; please use an ISO 639-1 code
  • {{Check ISO 639-1|}}