Template:Language exist: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
(massively simplified template)
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{#ifeq: {{#titleparts: {{FULLPAGENAME}} | | -1 }} | {{{1}}} | |{{#ifexist: {{#switch: {{#titleparts: {{FULLPAGENAME}} | | -1 }}
{{#ifeq: {{Get language code}} | {{{1}}} |<span></span>|{{#ifexist: {{No language suffix}}{{#ifeq: {{{1}}} | en ||/{{{1}}}}}|{{Flag|{{{1}}}}}|<span></span>
                      | cs| de | es | fr | it | nl | pt-br | ru | uk = {{#titleparts: {{FULLPAGENAME}}| -1 }}
}}}}<noinclude>
                      | #default = {{FULLPAGENAME}}
{{documentation}}
                  }}/{{{1}}} | {{#ifeq: {{{2|}}} | yes | <br/> • {{Flag|{{{1}}}|text=yes}} | {{Flag|{{{1}}}}} }}
[[Category:Localisation templates]]
}}}}
</noinclude>

Latest revision as of 16:26, 24 March 2020

[View] [Edit] [Page history]

Documentation

Shows a flag if a translated page with the given suffix exists, otherwise shows <span></span>.

Further explanation

Input: Given language code, for example de; en for English

if on page with the given language code then

  show nothing -- nothing = <span></span>

else

  if <pagename without lang suffix>/<given lang code> exists then -- current page translated to given language
    show flag
  else
    show nothing -- nothing = <span></span>
  end

end
List of all templates