Difference between revisions of "Template:Localize"
DesignerThan (talk | contribs) (in the case that the argument is a number but localization was called already the variable "result" probably had a value. In that case that was appended to the number. By redefining the variable and overwritting it with the number that shouldn't be an issue anymore) |
DesignerThan (talk | contribs) |
||
Line 16: | Line 16: | ||
<nowiki>{{</nowiki>Localize|Lorem ipsum}} → {{Localize|Lorem ipsum}} | <nowiki>{{</nowiki>Localize|Lorem ipsum}} → {{Localize|Lorem ipsum}} | ||
− | <nowiki>{{</nowiki>Localize|Switzerland| | + | <nowiki>{{</nowiki>Localize|Switzerland|Countries}} → {{Localize|Switzerland|Countries}} |
</noinclude> | </noinclude> |
Revision as of 22:03, 14 July 2021
This template returns a localized version of a "canned" phrase that we use in the interfaces. The phrase is in the language of the page that invokes it, so if we call the template from [[some page[[some page]], we'd get the English version of the page, but if we call it from [[some page/es]], we would get the Spanish version of the phrase.
The template can also take a second argument to specify a different page in the Localization namespace. If omitted, the template defaults to searching Localization:All. We may wish to use additional pages for things like honors, or the names of honor variants.
If no localization can be found (unless the argument is a number), the invoking page is added to a Category:Missing_Localization/page/key/language.
We don't throw an error on a numeric argument so that we can pass in a year - sometimes the year is a number, and sometimes it's "Unknown". We want to localize "Unknown" but pass the number through instead of returning a blank string.
Here is an example: {{Localize|2021}} → 2021
{{Localize|Answer Key}} →
{{Localize|Lorem ipsum}} →
{{Localize|Switzerland|Countries}} →