Making pages switch languages

From TNG_Wiki
Jump to navigation Jump to search

Wiki Extensions and Templates

To enable language switching, the following has allready been installed by TNG Wiki administration:

  1. LanguageSelector extension, which adds a language pull down selector above the Tools in the left sidebar. Example of the language pull down selector: 
    Click [Collapse]/[Expand] to hide/show the language selector example. Language selector.png
  2. ParserFunctions extensions
  3. Template:Languages
  4. Template:Languages/Lang
  5. Template:Languages/Title

Creating Language Pages

Note: "Languages" always starts with a capitalized "L"!

To make pages switch languages (e. g. creating an english page and non-english pages with the same content):

  1. If not already done, create an english page. Example for page name: Main Page
  2. For each non-english language, create an own new page with appended language code, for example Main Page/de or Main Page/fr or Main Page/es.
  3. Add the language template to the english page Main Page (example) as follows:
    • Click the "Language Template" button, and then delete the Text after 'Languages' in the code.
    • The code should look like: {{Languages}}.
  4. Add the language template to the non-english languages (/de, /fr, /es) as follows:
    • Click the "Language Template" button, and then change in the code everything after 'Languages|' into the name of the english page.
    • When the english page is Main Page, the code in the non-english pages (/de, /fr, /es) should be as follows: {{Languages|Main Page}}.
Result: Language switching is created.

To add the language template to categories:

  1. In non-english category pages (/de, /fr, /es), add: {{Languages|:Category:category_name}}.
  2. Replace 'category_name' by the name of the english category.
Result: The non-english category page is connected to the related english category page.
Notice: There is a colon : before the word Category.
Example: Category:Mods/de

To add the language template to templates:

  • In non-english templates, add {{Languages}} [[Category:Layout Templates]] at the bottom of the template before the </noinclude> tag.
Examples: Template:TNGmod and Template:TNGmod/de

Switching Sidebar Entries

In order to make the sidebar entries switcheable to a different language:

  1. For EACH english sidebar entry, create a non-english page by appending the language code (/de, /fr, /es) to the english page. Example: MediaWiki:entry/fr, where 'entry' is the term you want to translate, such as 'Glossary' and /fr (example) is the Language code.
  2. Enter the translation of the term, such as Glossaire de TNG'.
Result: Clicking on the sidebar link displays the english-page, allowing you to select the page in a different language if it has been translated.
Note: The MediaWiki options will be displayed in the language you have selected from the pull down selector on the bottom of the sidebar toolbox or in the language you specified as a logged-in user using the 'Preferences' link on top of the wiki page.