Difference between revisions of "Template:PutLangURL"

From PC-BSD Wiki
Jump to: navigation, search
(hope this works..)
Line 1: Line 1:
<includeonly>{{testLang}}</includeonly><noinclude>
+
<includeonly>{{#switch: {{getLang}}  <!-- The idea is to have a list of supported languages for a URL -->
 +
| {{{1}}}      = {{getLang}}
 +
| {{{2}}}      = {{getLang}}
 +
| {{{3}}}      = {{getLang}}
 +
| {{{4}}}      = {{getLang}}
 +
| {{{5}}}      = {{getLang}}
 +
| {{{6}}}      = {{getLang}}
 +
| {{{7}}}      = {{getLang}}
 +
| {{{8}}}      = {{getLang}}
 +
| {{{9}}}      = {{getLang}}
 +
| {{{10}}}      = {{getLang}}
 +
| {{{11}}}      = {{getLang}}
 +
| {{{12}}}      = {{getLang}}
 +
| {{{13}}}      = {{getLang}}
 +
| {{{14}}}      = {{getLang}}
 +
| {{{15}}}      = {{getLang}}
 +
| en            <!-- default -->
 +
}}</includeonly><noinclude>
 
This template allows for external URLs which may have a localized URL to automatically localize by swapping this template for the portion that has the iso language designation, such as with '''{{http}}www.freebsd.org/doc/'''''<nowiki>{{putLangURL}}</nowiki>'''''/books/developers-handbook/''' for {{http}}www.freebsd.org/doc/'''en'''/books/developers-handbook/. The normal result will be "en" because generally English URLs tend to be used as standard here. <!-- but a different default can be defined as needed via <nowiki>{{putLangURL|default=de}}</nowiki> as an example.
 
This template allows for external URLs which may have a localized URL to automatically localize by swapping this template for the portion that has the iso language designation, such as with '''{{http}}www.freebsd.org/doc/'''''<nowiki>{{putLangURL}}</nowiki>'''''/books/developers-handbook/''' for {{http}}www.freebsd.org/doc/'''en'''/books/developers-handbook/. The normal result will be "en" because generally English URLs tend to be used as standard here. <!-- but a different default can be defined as needed via <nowiki>{{putLangURL|default=de}}</nowiki> as an example.
 
{{#if:{{getLang}}|{{getLang}}|{{{default|en}}}}} -->
 
{{#if:{{getLang}}|{{getLang}}|{{{default|en}}}}} -->

Revision as of 01:08, 6 September 2013

This template allows for external URLs which may have a localized URL to automatically localize by swapping this template for the portion that has the iso language designation, such as with http://www.freebsd.org/doc/{{putLangURL}}/books/developers-handbook/ for http://www.freebsd.org/doc/en/books/developers-handbook/. The normal result will be "en" because generally English URLs tend to be used as standard here.