Template:Translation category: Difference between revisions

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.
put the {{ #vardefine: $lang }} outside the other logic, since it always gets defined in one way or another
Line 1: Line 1:
<includeonly>{{#vardefine: $lang-list | {{#dplreplace:
<includeonly>{{ #vardefine: $lang-list | {{ #dplreplace:
/ ar
/ ar
/ ca / cz
/ ca / cz
Line 20: Line 20:
/
/
|[\n ]}}<!-- trim whitespace to maintain "switch" feel -->
|[\n ]}}<!-- trim whitespace to maintain "switch" feel -->
}}{{
}}{{ #vardefine: $lang | {{
#if: {{#pos: {{#var: $lang-list }} | /{{SUBPAGENAME}}/ }}
  #if: {{ #pos: {{ #var: $lang-list }} | /{{SUBPAGENAME}}/ }}
| {{#vardefine: $lang | {{SUBPAGENAME}} }}
  | {{SUBPAGENAME}}
| {{#if: {{#pos: {{#var: $lang-list }} | /{{SUBPAGENAME:{{BASEPAGENAME}}}}/ }}
  | {{ #if: {{ #pos: {{ #var: $lang-list }} | /{{SUBPAGENAME:{{BASEPAGENAME}}}}/ }}
  | {{#vardefine: $lang | {{SUBPAGENAME:{{BASEPAGENAME}}}} }}
    | {{SUBPAGENAME:{{BASEPAGENAME}}}}
  | {{#vardefine: $lang | }}
    }}
   }}
   }}
}}{{
}}{{
#if: {{#var: $lang }}
#if: {{ #var: $lang }}
| {{#ifeq: {{{project|}}} | 0
| {{ #ifeq: {{{project|}}} | 0
   |
   |
   | [[Category:{{#if: trim | {{{1}}} }}/{{#var: $lang }}]] }}
   | [[Category:{{ #if: trim | {{{1}}} }}/{{ #var: $lang }}]] }}
| [[Category:{{#if: trim | {{{1}}} }}]]
| [[Category:{{ #if: trim | {{{1}}} }}]]
}}</includeonly><noinclude>
}}</includeonly><noinclude>
{{documentation}}
{{documentation}}
<!-- Put categories/interwiki on the documentation page -->
<!-- Put categories/interwiki on the documentation page -->