Template:Lang: Difference between revisions
Jump to navigation
Jump to search
(Redirected page to Template:Otherlang2) |
(trying out a new version of otherlang2 with automatic language detection, which has benefits.) |
||
Line 1: | Line 1: | ||
# | <!-- | ||
title | |||
-->{{#if: {{{title|}}} | {{DISPLAYTITLE:{{{title}}}}} }}<!-- | |||
html to make the buttons appear in the header space | |||
--><div style="position:relative;top:-32px;margin-bottom: -40px;float:right;text-align:right;padding:2px;line-height:11px;background:#262626;<!-- | |||
optional taking away of the icon borders | |||
-->{{#if: {{{noborder|}}} | margin-top:5px;border:0; | border:1px solid #65635F;border-bottom:0;}}"><!-- | |||
For English: | |||
Test if [page's unique name according to editor, excluding language suffix] is equal to [page name without namespace, possibly including language suffix]. | |||
-If they match, then we must be on the English page already, therefore don't display the English icon. | |||
-If they do not match, show the English link, cause this is NOT the English page. | |||
We're not going to test if the English page exists or not. It damn well better. | |||
-->{{#ifeq: {{{1}}} | {{PAGENAME}} | | '''[[File:En.png|alt=English|link={{{en}}}]]''' }}<!-- | |||
Other languages are a little more complex: | |||
Test if the page [page's unique name according to editor, excluding language suffix]:[X language suffix] exists. | |||
-If the page does exist, check if we're on that page right now by testing if [page's unique name according to editor, excluding language suffix]:[X language suffix] is equal to [page name without namespace, possibly including language suffix]. | |||
--If they match, don't show the icon for this language, because we're already on that page. | |||
--If they do not match, show the icon for the language, because that page exists AND we currently are not on it. | |||
-If the page does not exist, don't show the icon for it obviously. | |||
Czech - cs | |||
-->{{#ifexist: {{{1}}}:cs | <!-- | |||
-->{{#ifeq: {{{1}}}:cs | {{PAGENAME}} | | [[File:cs.png|alt=Čeština|link={{{cs}}}]] }}<!-- | |||
--> | }}<!-- | |||
German - de | |||
-->{{#ifexist: {{{1}}}:de | <!-- | |||
-->{{#ifeq: {{{1}}}:de | {{PAGENAME}} | | [[File:de.png|alt=Deutsch|link={{{de}}}]] }}<!-- | |||
--> | }}<!-- | |||
Spanish - es | |||
-->{{#ifexist: {{{1}}}:es | <!-- | |||
-->{{#ifeq: {{{1}}}:es | {{PAGENAME}} | | [[File:es.png|alt=Español|link={{{es}}}]] }}<!-- | |||
--> | }}<!-- | |||
French - fr | |||
-->{{#ifexist: {{{1}}}:fr | <!-- | |||
-->{{#ifeq: {{{1}}}:fr | {{PAGENAME}} | | [[File:fr.png|alt=Français|link={{{fr}}}]] }}<!-- | |||
--> | }}<!-- | |||
Hungarian - hu | |||
-->{{#ifexist: {{{1}}}:hu | <!-- | |||
-->{{#ifeq: {{{1}}}:hu | {{PAGENAME}} | | [[File:hu.png|alt=Magyar|link={{{hu}}}]] }}<!-- | |||
--> | }}<!-- | |||
Italian - it | |||
-->{{#ifexist: {{{1}}}:it | <!-- | |||
-->{{#ifeq: {{{1}}}:it | {{PAGENAME}} | | [[File:it.png|alt=Italiano|link={{{it}}}]] }}<!-- | |||
--> | }}<!-- | |||
Dutch - nl | |||
-->{{#ifexist: {{{1}}}:nl | <!-- | |||
-->{{#ifeq: {{{1}}}:nl | {{PAGENAME}} | | [[File:nl.png|alt=Nederlands|link={{{nl}}}]] }}<!-- | |||
--> | }}<!-- | |||
Norwegian - no | |||
-->{{#ifexist: {{{1}}}:no | <!-- | |||
-->{{#ifeq: {{{1}}}:no | {{PAGENAME}} | | [[File:no.png|alt=Norsk|link={{{no}}}]] }}<!-- | |||
--> | }}<!-- | |||
Polish - pl | |||
-->{{#ifexist: {{{1}}}:pl | <!-- | |||
-->{{#ifeq: {{{1}}}:pl | {{PAGENAME}} | | [[File:pl.png|alt=Polski|link={{{pl}}}]] }}<!-- | |||
--> | }}<!-- | |||
Portuguese - pt | |||
-->{{#ifexist: {{{1}}}:pt | <!-- | |||
-->{{#ifeq: {{{1}}}:pt | {{PAGENAME}} | | [[File:pt.png|alt=Português|link={{{pt}}}]] }}<!-- | |||
--> | }}<!-- | |||
Brazilian Portuguese - pt-br | |||
-->{{#ifexist: {{{1}}}:pt-br | <!-- | |||
-->{{#ifeq: {{{1}}}:pt-br | {{PAGENAME}} | | [[File:pt-br.png|alt=Português-Brasileiro|link={{{pt-br}}}]] }}<!-- | |||
--> | }}<!-- | |||
Russian - ru | |||
-->{{#ifexist: {{{1}}}:ru | <!-- | |||
-->{{#ifeq: {{{1}}}:ru | {{PAGENAME}} | | [[File:ru.png|alt=Русский|link={{{ru}}}]] }}<!-- | |||
--> | }}<!-- | |||
Ukrainian - ua | |||
-->{{#ifexist: {{{1}}}:ua | <!-- | |||
-->{{#ifeq: {{{1}}}:ua | {{PAGENAME}} | | [[File:ua.png|alt=Українська|link={{{ua}}}]] }}<!-- | |||
--> | }}<!-- | |||
Swedish - sv | |||
-->{{#ifexist: {{{1}}}:sv | <!-- | |||
-->{{#ifeq: {{{1}}}:sv | {{PAGENAME}} | | [[File:sv.png|alt=Svenska|link={{{sv}}}]] }}<!-- | |||
--> | }}<!-- | |||
Turkish - tr | |||
-->{{#ifexist: {{{1}}}:tr | <!-- | |||
-->{{#ifeq: {{{1}}}:tr | {{PAGENAME}} | | [[File:tr.png|alt=Türkçe|link={{{tr}}}]] }}<!-- | |||
--> | }}<!-- | |||
Japanese - jp | |||
-->{{#ifexist: {{{1}}}:jp | <!-- | |||
-->{{#ifeq: {{{1}}}:jp | {{PAGENAME}} | | [[File:jp.png|alt=日本語|link={{{jp}}}]] }}<!-- | |||
--> | }}<!-- | |||
Simplified Chinese - zh-cn | |||
-->{{#ifexist: {{{1}}}:zh-cn | <!-- | |||
-->{{#ifeq: {{{1}}}:zh-cn | {{PAGENAME}} | | [[File:zh-cn.png|alt=简体中文|link={{{zh-cn}}}]] }}<!-- | |||
--> | }}<!-- | |||
Taiwanese Mandarin - zh-tw | |||
-->{{#ifexist: {{{1}}}:zh-tw | <!-- | |||
-->{{#ifeq: {{{1}}}:zh-tw | {{PAGENAME}} | | [[File:zh-tw.png|alt=简体中文|link={{{zh-tw}}}]] }}<!-- | |||
--> | }}<!-- | |||
Korean - ko | |||
-->{{#ifexist: {{{1}}}:ko | <!-- | |||
-->{{#ifeq: {{{1}}}:ko | {{PAGENAME}} | | [[File:ko.png|alt=한국어|link={{{ko}}}]] }}<!-- | |||
--> | }}<!-- | |||
Georgian - ka | |||
-->{{#ifexist: {{{1}}}:ka | <!-- | |||
-->{{#ifeq: {{{1}}}:ka | {{PAGENAME}} | | [[File:ka.png|alt=ქართული ენა|link={{{ka}}}]] }}<!-- | |||
--> | }}<!-- | |||
Hebrew - he | |||
-->{{#ifexist: {{{1}}}:he | <!-- | |||
-->{{#ifeq: {{{1}}}:he | {{PAGENAME}} | | [[File:he.png|alt=עִברִית|link={{{he}}}]] }}<!-- | |||
--> | }} |