Difference between revisions of "Template:Localize"

From Pathfinder Wiki
(Add second argument to specify altpage, and add page to category if no localization found.)
(Add second parameter to category page structure.)
Line 1: Line 1:
<includeonly><nowiki/>{{#vardefine:result|{{#lst:Localization:{{{2|All}}}{{GetLangSuffix}}|{{{1|Phrase cannot be localized}}}}}}}{{#if:{{#var:result}}|{{#var:result}}|[[Category:Missing Localization/{{{1|unsupplied}}}{{GetLangSuffix}}]]}}</includeonly><noinclude>
+
<includeonly><nowiki/>{{#vardefine:result|{{#lst:Localization:{{{2|All}}}{{GetLangSuffix}}|{{{1|Phrase cannot be localized}}}}}}}{{#if:{{#var:result}}|{{#var:result}}|[[Category:Missing Localization/{{{2|All}}}/{{{1|unsupplied}}}{{GetLangSuffix}}]]}}</includeonly><noinclude>
 
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  
 
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  
 
<nowiki>[[</nowiki>some page<nowiki>[[</nowiki>some page]], we'd get the English version of the page, but if we call it from <nowiki>[[</nowiki>some page/es]], we would get the Spanish version of the phrase.   
 
<nowiki>[[</nowiki>some page<nowiki>[[</nowiki>some page]], we'd get the English version of the page, but if we call it from <nowiki>[[</nowiki>some page/es]], we would get the Spanish version of the phrase.   
Line 5: Line 5:
 
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.
 
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, the invoking page is added to a Category:Missing_Localization/key/language.
+
If no localization can be found, the invoking page is added to a Category:Missing_Localization/''page''/''key''/''language''.
  
 
Here is an example:
 
Here is an example:

Revision as of 23:42, 9 April 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, the invoking page is added to a Category:Missing_Localization/page/key/language.

Here is an example: {{Localize|Answer Key}} →

{{Localize|Lorem ipsum}} →