Template:Language info/doc: Difference between revisions

From Terraria Wiki
Jump to navigation Jump to search
No edit summary
(Revamp.)
Line 1: Line 1:
Used to handle interwiki links, and delegate {{tl|translation projects}}.
This template displays interwiki links, helps organizing the [[Terraria Wiki:Projects#Language projects|translation projects]], and performs some additional miscellaneous operations.


It should be placed at the end of ''every'' page in the following [[mw:Help:Namespaces|namespaces]]: {{dotlist|{{code|(Main)}}|{{code|Terraria Wiki}}|{{code|Template}}|{{code|Help}}|{{code|Category}}}}
The basic idea is to collect page information from each language wiki, merge them to form a database on en, and then distribute it to each language wiki.

The template calls {{tl|code=y|translation projects}} and {{tl|code=y|common}}. It is furthermore the core part of the automatic interwiki link system of the Terraria Wiki: It collects the page names and English interwiki links from each language wiki, merges them to form a database on the English wiki, and then displays the interwiki links according to the language wiki and page it is used on.


== Usage ==
== Usage ==
<code>{{(}} language info | en = ''&lt;English page name&gt;'' {{)}}</code>


; en
On en wiki(include onwiki non-English languages):
Name of the English page. On the English wiki, this must be identical to the page name, so it can be set to <code>{{(}}subst:FULLPAGENAME{{)}}</code>. On language wikis (both on-wiki<ref name="onWikiList"/> and off-wiki<ref name="offWikiList"/>), it should be the name of the English version of the page.
<code>{{(}}language info{{)}}</code><br/>
or:
<code>{{(}}language info|en=<en page name>{{)}}</code> (mainly for templates/modules, easier to sync for offwiki language wikis)

You can use <code>{{(}}subst:{{)}}</code> to do it easier, e.g.:

<code>{{(}}language info|en={{(}}subst:FULLPAGENAME{{)}}{{)}}</code> (for English pages).

On language wikis (offwiki languages):
<code>{{(}}language info|en=<en page name>{{)}}</code> (must and only need to specify en page name (as index key))


That's all.

== Database Maintenance ==

The database for this template is stored in [[Module:Language_info/data]]. Maintenance work consists of two steps.


== Interwiki link database maintenance ==
Step 1: Maintain the main database
The automatic interwiki link system relies on the database [[Module:Language info/data]]. It is based on all the {{tl|nl=y|language info}} calls on all the different wikis. This database needs to be updated periodically; the most recent version is always at [[Template:Language info/datagen]]. {{note|paren=y|Because this template transcludes several templates with very long outputs, it might fail to load. In this case, inspect the {{fullurl|Template:Language info/datagen|action=edit|text=source code}} of the template and assemble its output manually.}} Once updated, all the interwiki links on the English wiki and the on-wiki languages<ref name="onWikiList"/> will be up-to-date.
Get codes from [[Template:Language_info/luadata]] from all wikis (en and every offwiki language wiki), merge them into [[Module:Language_info/data]].


The off-wiki languages<ref name="offWikiList"/> also require the database [[Module:Language info/data]]. It can simply be synced as-is from the English wiki.
Step 1: Sync it to offwiki language wikis
Sync the content of Module:Language_info/data to every language wiki (zh/fr/de....).


== Footnotes ==
{{reflist|refs=
<ref name=offWikiList>{{#lstmap:{{#listsort:list={{langList|offWiki}}|insep=,|token=@@@@|pattern=<esc>{{langInfo|@@@@|name}}</esc>|sortoptions=alpha}}|,|@@@@|<esc>[[Terraria Wiki:Projects/{{langInfo|@@@@|name}} translation|{{langInfo|@@@@|name}} (@@@@)]]</esc>}}</ref>
<ref name=onWikiList>{{#lstmap:{{#listsort:list={{langList|onWiki}}|insep=,|token=@@@@|pattern=<esc>{{langInfo|@@@@|name}}</esc>|sortoptions=alpha}}|,|@@@@|<esc>[[Terraria Wiki:Projects/{{langInfo|@@@@|name}} translation|{{langInfo|@@@@|name}} (@@@@)]]</esc>}}</ref>
}}


<!-- Note: categories and interwikis for the template should be placed in template itself, please do not put them here -->
<!-- Note: categories and interwikis for the template should be placed in template itself, please do not put them here -->

Revision as of 17:46, 24 June 2022

This template displays interwiki links, helps organizing the translation projects, and performs some additional miscellaneous operations.

It should be placed at the end of every page in the following namespaces:

  • (Main)
  • Terraria Wiki
  • Template
  • Help
  • Category

The template calls {{translation projects}} and {{common}}. It is furthermore the core part of the automatic interwiki link system of the Terraria Wiki: It collects the page names and English interwiki links from each language wiki, merges them to form a database on the English wiki, and then displays the interwiki links according to the language wiki and page it is used on.

Usage

{{ language info | en = <English page name> }}

en

Name of the English page. On the English wiki, this must be identical to the page name, so it can be set to {{subst:FULLPAGENAME}}. On language wikis (both on-wiki[1] and off-wiki[2]), it should be the name of the English version of the page.

Interwiki link database maintenance

The automatic interwiki link system relies on the database Module:Language info/data. It is based on all the {{language info}} calls on all the different wikis. This database needs to be updated periodically; the most recent version is always at Template:Language info/datagen. (Because this template transcludes several templates with very long outputs, it might fail to load. In this case, inspect the source code of the template and assemble its output manually.) Once updated, all the interwiki links on the English wiki and the on-wiki languages[1] will be up-to-date.

The off-wiki languages[2] also require the database Module:Language info/data. It can simply be synced as-is from the English wiki.

Footnotes