Permanently protected template

Template:Other languages

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

Template documentation[view] [edit] [history] [purge]

This template is used in other templates with the name "Template:Other languages/Page name".

For example,

{{other languages|ar|ast|csb|da|de|diq|el|en|es|eu|fa|fr|hi|it|ja|ko|ml|ms|nl|oc|pl|pt-br|ro|ru|sv|uk|yi|zh|doctest|page=Meta:Administrators}}

renders as:

Warning about the implementation:

  • to avoid the nasty "template include depth limit exceeded" error (for example on Board elections/2008), do not factorize the list of #if making this template. Keep it linear, otherwise it will break important pages on this wiki using this template for accessing available translations. The way it is made does not exhaust the server resources (it also allows this template to support up to 80 languages, possibly more if the template is extended to support more parameters), but factorizing #if will exhaust them (in terms of total parameter size for their expansion) and will definitely not optimize things.
  • this template still uses the costly parser function #ifexist for each language code in parameter, in order to generate customized creation links (using the specified base page name to preload it) instead of standard red links for inexistant pages. It cannot be used on pages where this template would be implicitly called by transcluding many other pages or templates referencing it. For a version of this template that does not use preloads but generate standard red wikilinks, use the variant Template:Other languages/not tested:
{{other languages/not tested|ar|ast|csb|da|de|diq|el|en|es|eu|fa|fr|hi|it|ja|ko|ml|ms|nl|oc|pl|pt-br|ro|ru|sv|uk|yi|zh|doctest|page=Meta:Administrators}}

renders as:

See how the non-existing language code "doctest" is no longer rendered in red but brings to a page that will not create the subpage by default.