Template:Translation category: Difference between revisions

From Modded Wiki
Jump to navigation Jump to search
Restore trim
Now will check both the subpage of the last level and the second to last for the language code, thus supports translated tutorials/mods, and inconsistent translated subpage formats.
Line 1: Line 1:
<includeonly>{{
<includeonly>{{#vardefine: $lang-list | {{#dplreplace:
#switch: {{#vardefineecho: $lang | {{
/ ar
#ifeq: {{ROOTPAGENAME}} | {{BASEPAGENAME}}
/ ca / cz
| {{SUBPAGENAME}}
/ dk
| {{SUBPAGENAME:{{BASEPAGENAME}}}}
/ el / eo / et
}} }}
/ fa / fin
| ar
/ ga
| ca | cz
/ he / hr
| dk
/ id
| el | eo | et
/ lv / lt
| fa | fin
/ moh
| ga
/ no
| he | hr
/ pt / ph
| id
/ ro
| lv | lt
/ sr / sk / se
| moh
/ th / tr
| no
/ ua
| pt | ph
/ vi
| ro
/ yi
| sr | sk | se
/
| th | tr
|[\n ]}}<!-- trim whitespace to maintain "switch" feel -->
| ua
}}{{
| vi
#if: {{#pos: {{#var: $lang-list }} | /{{SUBPAGENAME}}/ }}
| yi = {{#ifeq: {{{project|}}} | 0 || [[Category:{{#if:1|{{{1}}}}}/{{#var: $lang }}]] }}
| {{#vardefine: $lang | {{SUBPAGENAME}} }}
| #default = [[Category:{{#if:1|{{{1}}}}}]]
| {{#if: {{#pos: {{#var: $lang-list }} | /{{SUBPAGENAME:{{BASEPAGENAME}}}}/ }}
  | {{#vardefine: $lang | {{SUBPAGENAME:{{BASEPAGENAME}}}} }}
  | {{#vardefine: $lang | }}
  }}
}}{{
#if: {{#var: $lang }}
| {{#ifeq: {{{project|}}} | 0
  |
  | [[Category:{{#if: trim | {{{1}}} }}/{{#var: $lang }}]] }}
| [[Category:{{#if: trim | {{{1}}} }}]]
}}</includeonly><noinclude>
}}</includeonly><noinclude>
{{documentation}}
{{documentation}}
<!-- Put categories/interwiki on the documentation page -->
<!-- Put categories/interwiki on the documentation page -->

Revision as of 03:01, 3 February 2015

[view] [edit] [history] [refresh]Documentation

This template is used to add a category to a template that automatically uses the translation project category for a translation project. Note that this template is useless if you do not have translation projects, so any calls in other templates can be replaced with a direct category link.

Usage

|1= can be set to the name of the category. It is used directly on main pages, and |1=/lang is used on translation projects.

If |project= has a value, it won't add a category on the translation project pages.

cs:Šablona:Translation category ja:テンプレート:Translation category th:แม่แบบ:Translation category uk:Шаблон:Категорія перекладу

[view] [edit] [history] [refresh]The above documentation is transcluded from Template:Translation category/doc.