Difference between revisions of "Template:GetHonorName"

From Pathfinder Wiki
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
+
<languages />
 +
<translate>
 +
<!--T:1-->
 
This template will return the translated honor name of the specified page. If no page parameter is supplied, it operates on the page invoking the template.
 
This template will return the translated honor name of the specified page. If no page parameter is supplied, it operates on the page invoking the template.
 +
It is also possible to pass in an honorname.
 +
</translate>
  
 
<nowiki>{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements}}</nowiki><br/>
 
<nowiki>{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements}}</nowiki><br/>
 
{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements}}<br/>
 
{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements}}<br/>
<nowiki>{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements/es}}</nowiki><br/>
 
{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements/es}}
 
<nowiki>{{GetHonorName|page=AY Honors/Alternative Fuels (United States)/Requirements}}</nowiki><br/>
 
{{GetHonorName|page=AY Honors/Alternative Fuels (United States)/Requirements}}
 
  
==How does it work?==
+
<nowiki>{{GetHonorName|page=AY Honors/Worms - Advanced/Requirements}}</nowiki><br/>
When a page is translated, the page title is also (usually) translated.  This translation is saved at <nowiki>[[</nowiki>Translations:''source_page_name''/Page display title/''language'']].  This template first uses <nowiki>{{GetLanguageSuffix}}</nowiki> to determine the language of the page.  That template will return an empty string if this is the English page (or source page).
+
{{GetHonorName|page=AY Honors/Worms - Advanced/Requirements}}<br/>
  
The output of <nowiki>GetLangSuffix</nowiki> is passed to an #if parser.  If it returns a non-empty string, this template will strip the last element (the language code) off the invoking page, prepends the Translations: name space to it, and then appends "Page display title" and the language code.  This give us the name of the page that has the translated title.  The contents of that page is passed to the outer #titleparts which extracts the second element from that page name.
+
<nowiki>{{GetHonorName|honorname=Camping Skills I}}</nowiki><br/>
 +
{{GetHonorName|honorname={{{honorname|Camping Skills I}}}}}<br/>
  
This assumes that the second element of the page title is the honor name (as in "AY Honors/honorname/subpages/language").
+
<includeonly><onlyinclude>{{#vardefine:locHonorname|{{#if:{{{honorname|}}}|{{{honorname}}}|{{#titleparts:{{#if:{{{page|}}}|{{{page}}}|{{PAGENAME}}}}|1|2}}}}}}{{Localize|{{#var:locHonorname}}|Honors}}</onlyinclude></includeonly>
 
 
</noinclude><includeonly>{{#if:{{GetLangSuffix|page={{{page|{{PAGENAME}}}}}}}
 
|{{#titleparts:{{:{{#titleparts:Translations:{{{page|{{PAGENAME}}}}}|-1}}/Page display title{{GetLangSuffix|page={{{page|{{PAGENAME}}}}}}}}}|1|2}}
 
|{{#titleparts:{{{page|{{PAGENAME}}}}}|1|2}}}}</includeonly>
 

Latest revision as of 03:30, 24 February 2022

Other languages:
Deutsch • ‎English • ‎español • ‎français

This template will return the translated honor name of the specified page. If no page parameter is supplied, it operates on the page invoking the template. It is also possible to pass in an honorname.

{{GetHonorName|page=AY Honors/Alternative Fuels/Requirements}}

Cannot access the database: :real_connect(): (08004/1040): Too many connections


{{GetHonorName|page=AY Honors/Worms - Advanced/Requirements}}
Worms - Advanced

{{GetHonorName|honorname=Camping Skills I}}
Camping Skills I