Template:LLS/doc
This is a documentation subpage for Template:LLS. It contains usage information, categories and other content or metadata that is not part of the original template. |
Usage
This template determines the full page name of a specified page or category translated into the language used in the page currently viewed. If the target page or category is not found in that language with the same language code, and also not found another suitable fallback language, it returns the generic (untranslated) page or category without the leading language code (assuming it is written in English on this wiki).
- The mandatory parameter
1
is the target category name (normally in English) without any language code prefix namespace, and without the namespace prefix.- Warning: you must name this parameter explicitly if its value contains an equal sign, for example
{{LLS|Tag:highway=primary}}
will not work (it will generate "{{{1}}}", ignoring the unknown parameter), but{{LLS|1=Tag:highway=primary}}
will work as intended (it will generate "Tag:highway=primary" within a page in French, because the target page exists in French, or "Tag:highway=primary" within a page written in a language for which the specified English tag description page has still not be translated).
- Warning: you must name this parameter explicitly if its value contains an equal sign, for example
- The optional parameter
ns
is the leading namespace name, with its final colon (:), where the translated page is to be searched for (e.g., "Template:", "Category:"). If this parameter is empty (the default) the page name is assumed to be an article in the main namespace.- This
ns
parameter is now deprecated (but still supported for compatibility and transition reasons), now you can use directly the full pagename of the English pagename, including when it is a category page, or template, or if it in another namespace): pages that are still using thisns
parameter should remove it and merge its value with the page name.
- This
- The optional parameter
lang
may also be used to indicate the desired language of the target page to link to (which in most cases should be the language effectively used on the current page, if it cannot be determined from its current unprefixed pagename).
Note that it is still not possible to do that in "User:" namespace, because "User:XXX" and "User:DE:XXX" are for distinct users and no translation of their user pages should be assumed between each other.
But it is possible for "Talk" pages associated to all other namespaces (including the main namespace): when using ns=Talk:
is specified, if a specific talk page is created and exists for a translated page, links created by this LLS template will go to the Talk page associated to the page without the language code prefix.
If you want to merge existing talk pages in various languages to a single one, because you only want to follow a single talk page for all languages, you should redirect them to the Talk page without the prefix, but more frequently you'll just add a link at top of talk pages you don't want to maintain, and you should include a link in a section of the unified Talk page to list the former "translated" talk pages that contain the former discussions.
Example
- {{LLS|Help:Contents}}, when used in a Swiss German page (using the "De-ch:" prefix) will try to locate "De-ch:Help:Contents" if it exists (this can be a redirect to another page name also starting with the "De-ch:" prefix, but with the rest of the title translated into Swiss German:
- when this page exists, it returns that full page name ("De-ch:Help:Contents" in this example — note that even if this is a redirect, the target of this redirect cannot be determined using the current version of MediaWiki);
- otherwise it looks for a possible fallback in another language (e.g., "de" for "de-ch"), and returns its full page name in with the correct prefix if such page exists ("DE:Help:Contents" in this example, here it is a redirect to);
- otherwise it return the full page name without the language code prefix (i.e., "Help:Contents" in this example).
Warning: maintenance of redirects
Note that redirects such as to must be kept because these pages are using the Languages template which cannot determine the target name of redirects itself, instead the Languages template is used with the English pagename (and the optional namespace prefix in a parameter similar to this LLS template) and pages are accessible via this redirect (those links via a redirect are needed only for switching from one language to another).
When renaming pages for translating page titles from English, this creates such redirects: make sure however that, after such renaming, all existing redirects (listed by the "Linked pages" tool in the side bar) are not double redirects: modify all existing redirects to point to the new full name and not to the full name before your renaming.
See also
- {{Langcode}} – logic to automatically return the (lowercase) code of the language used in the currently viewed page, according to the namespace or pseudonamespage used in its full pagename.
- {{LangPrefix}} – logic to determine the correct prefix to use for any language code (or optionally the prefix for a fallback if one is defined)
- {{LLC}} – similar to {{LLS}} but for locating a translated Category (in the "Category:" namespace)
- {{LLT}} – similar to {{LLS}} but for locating a translated template (in the "Template:" namespace)