Template:S

From Valve Developer Community
Jump to navigation Jump to search

Usually when /strings subpage is used it contains all the strings for all languages and the template calls it and chooses one based on language of the given page which is determined by {{Language}}.

This template can be used to keep english text on the template page and other translated text on /strings subpages all without transcluding the /strings subpage in case we are on english page.

{{s|test}} becomes test/strings on non-english pages and #if: on english pages. Which means that the following

{{ {{s|test}}|string-name|english text }}

will on english page become

{{ #if:|string-name|english text}} //which evaluates just to "english text"

On non-english page it calls /strings subpage and passes string-name and english text as parameters

{{ test/strings|string-name|english text }}

And if the /strings subpage doesn't have translation for string named "string-name" then it can just return the english text which is {{{2}}}