Difference between revisions of "Template:PutLangURL"

From PC-BSD Wiki
Jump to: navigation, search
(hope this works..)
 
Line 1: Line 1:
<includeonly>{{#switch: {{getLang}}   <!-- The idea is to have a list of supported languages for a URL -->
+
<includeonly>{{#if:{{getLang}}|{{getLang}}|{{{default|en}}}}}</includeonly><noinclude>
| {{{1}}}      = {{getLang}}
+
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.
| {{{2}}}      = {{getLang}}
+
 
| {{{3}}}       = {{getLang}}
+
<!-- This will allow any language to succeed but to limit to known localized sites use template testLangURL -->
| {{{4}}}      = {{getLang}}
+
 
| {{{5}}}      = {{getLang}}
+
<!-- but a different default can be defined as needed via <nowiki>{{putLangURL|default=de}}</nowiki> as an example. -->
| {{{6}}}      = {{getLang}}
+
[[category:templates]]
| {{{7}}}      = {{getLang}}
+
</noinclude>
| {{{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.
+
{{#if:{{getLang}}|{{getLang}}|{{{default|en}}}}} -->
+

Latest revision as of 01:20, 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.