Difference between revisions of "Template:Translation"

From Nookipedia, the Animal Crossing wiki
(Template will now adjust column count based on string length of translation input instead of English name. Changed name of length parameter to max-length.)
(Making 3-column display the exception, not the rule. Adjusting max-length value to 30. Adding default length value of 7 for translation parameters if no value is entered.)
Line 1: Line 1:
{{#if:{{#ifexpr: {{#expr:{{#len:{{{ja-name|}}}}} + {{#len:{{{zh-name|}}}}} + {{#len:{{{zht-name|}}}}}}} < {{{max-length|31}}} | 3-col |}}{{#ifexpr: {{#expr:{{#len:{{{ko-name|}}}}} + {{#len:{{{fr-name|}}}}} + {{#len:{{{frq-name|}}}}}}} < {{{max-length|31}}} | 3-col |}}{{#ifexpr: {{#expr:{{#len:{{{it-name|}}}}} + {{#len:{{{es-name|}}}}} + {{#len:{{{esl-name|}}}}}}} < {{{max-length|31}}} | 3-col |}}{{#ifexpr: {{#expr:{{#len:{{{de-name|}}}}} + {{#len:{{{nl-name|}}}}} + {{#len:{{{ru-name|}}}}}}} < {{{max-length|31}}} | 3-col |}}|
+
{{#if:{{#ifexpr: {{#expr:{{#len:{{{ja-name|Unknown}}}}} + {{#len:{{{zh-name|Unknown}}}}} + {{#len:{{{zht-name|Unknown}}}}}}} > {{{max-length|30}}} | 2-col |}}{{#ifexpr: {{#expr:{{#len:{{{ko-name|Unknown}}}}} + {{#len:{{{fr-name|Unknown}}}}} + {{#len:{{{frq-name|Unknown}}}}}}} > {{{max-length|30}}} | 2-col |}}{{#ifexpr: {{#expr:{{#len:{{{it-name|Unknown}}}}} + {{#len:{{{es-name|Unknown}}}}} + {{#len:{{{esl-name|Unknown}}}}}}} > {{{max-length|30}}} | 2-col |}}{{#ifexpr: {{#expr:{{#len:{{{de-name|Unknown}}}}} + {{#len:{{{nl-name|Unknown}}}}} + {{#len:{{{ru-name|Unknown}}}}}}} > {{{max-length|30}}} | 2-col |}}|
 
<div style="text-align:left; line-height:1em; display:inline-block;">
 
<div style="text-align:left; line-height:1em; display:inline-block;">
 +
[[File:Flag of Japan.png|Japanese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ja-name|}}}|{{{ja-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
[[File:Flag of the People's Republic of China.png|Chinese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{zh-name|}}}|{{{zh-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
[[File:Flag of France.png|French|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{fr-name|}}}|{{{fr-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
[[File:Flag of Spain.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{es-name|}}}|{{{es-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
[[File:Flag of Italy.png|Italian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{it-name|}}}|{{{it-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
[[File:Flag of Russia.png|Russian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ru-name|}}}|{{{ru-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
 +
</div>
 +
<div style="text-align:left; line-height:1em; display:inline-block;">
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Korea.png|Korean|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ko-name|}}}|{{{ko-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Hong Kong.png|Chinese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{zht-name|}}}|{{{zht-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Quebec.png|French|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{frq-name|}}}|{{{frq-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Mexico.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{esl-name|}}}|{{{esl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Germany.png|German|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{de-name|}}}|{{{de-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 +
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of the Netherlands.png|Dutch|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{nl-name|}}}|{{{nl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
 +
</div>
 +
|<div style="text-align:left; line-height:1em; display:inline-block;">
 
[[File:Flag of Japan.png|Japanese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ja-name|}}}|{{{ja-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Japan.png|Japanese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ja-name|}}}|{{{ja-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Korea.png|Korean|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ko-name|}}}|{{{ko-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Korea.png|Korean|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ko-name|}}}|{{{ko-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
Line 17: Line 33:
 
[[File:Flag of Mexico.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{esl-name|}}}|{{{esl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Mexico.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{esl-name|}}}|{{{esl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Russia.png|Russian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ru-name|}}}|{{{ru-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
 
[[File:Flag of Russia.png|Russian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ru-name|}}}|{{{ru-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
</div>
 
|<div style="text-align:left; line-height:1em; display:inline-block;">
 
[[File:Flag of Japan.png|Japanese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ja-name|}}}|{{{ja-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of the People's Republic of China.png|Chinese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{zh-name|}}}|{{{zh-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of France.png|French|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{fr-name|}}}|{{{fr-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Spain.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{es-name|}}}|{{{es-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Italy.png|Italian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{it-name|}}}|{{{it-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
[[File:Flag of Russia.png|Russian|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ru-name|}}}|{{{ru-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
 
</div>
 
<div style="text-align:left; line-height:1em; display:inline-block;">
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Korea.png|Korean|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{ko-name|}}}|{{{ko-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Hong Kong.png|Chinese|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{zht-name|}}}|{{{zht-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Quebec.png|French|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{frq-name|}}}|{{{frq-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Mexico.png|Spanish|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{esl-name|}}}|{{{esl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of Germany.png|German|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{de-name|}}}|{{{de-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span><br>
 
<span style="padding-left:{{{spacing|.6em}}};"></span>[[File:Flag of the Netherlands.png|Dutch|link=|14px]]&nbsp;<span style="font-size:.75em;">{{#if:{{{nl-name|}}}|{{{nl-name|}}}|{{Colorshow|{{{color|ccc}}}|Unknown}}}}</span>
 
 
</div>}}<noinclude>
 
</div>}}<noinclude>
 
==Usage==
 
==Usage==
Line 57: Line 57:
 
For use in Infobox-style templates to display translation information. Will appear as two columns if the length of the page or the <code>name</code> parameter is greater than 12 characters.
 
For use in Infobox-style templates to display translation information. Will appear as two columns if the length of the page or the <code>name</code> parameter is greater than 12 characters.
 
* <code>spacing</code> can be used to adjust the padding in between the translation columns.
 
* <code>spacing</code> can be used to adjust the padding in between the translation columns.
* <code>max-length</code> can be used to change the character count/force the 2-column or 3-column display. The default value is 31. Increasing the value creates a tendency towards a 3-column display, decreasing it, a 2-column display.
+
* <code>max-length</code> can be used to change the character count/force the 2-column or 3-column display. The default value is 30. Increasing the value creates a tendency towards a 3-column display, decreasing it, a 2-column display.

Revision as of 14:44, May 2, 2020

Japanese Unknown
Korean Unknown
Italian Unknown
German Unknown

Chinese Unknown
French Unknown
Spanish Unknown
Dutch Unknown

Chinese Unknown
French Unknown
Spanish Unknown
Russian Unknown

Usage

{{Translation
| name     = <optional>
| color    = <hexcode (no preceding '#')>
| length   = <optional>
| spacing  = <optional>
| ja-name  = <japanese>
| ko-name  = <korean>
| zh-name  = <chinese (simplified)>
| zht-name = <chinese (traditional)>
| fr-name  = <french>
| frq-name = <french (quebec)> 
| es-name  = <spanish>
| esl-name = <spanish (latin america)>
| it-name  = <italian>
| de-name  = <german>
| nl-name  = <dutch>
| ru-name  = <russian>
}}

For use in Infobox-style templates to display translation information. Will appear as two columns if the length of the page or the name parameter is greater than 12 characters.

  • spacing can be used to adjust the padding in between the translation columns.
  • max-length can be used to change the character count/force the 2-column or 3-column display. The default value is 30. Increasing the value creates a tendency towards a 3-column display, decreasing it, a 2-column display.