Help:Add language bar

From Free Pascal wiki
Jump to: navigation, search

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) 日本語 (ja) 한국어 (ko) polski (pl) português (pt) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

Overview

This page describes how a language bar can be added to translated - and original - pages. The language bar helps users to see, what translations are available. If he comes to an English page through a search engine, he can see immediately, if the page is available in his own language too.

Templates are used to reduce maintenance if a page gets a new translation. The translated page only needs to be added to the template and it will be available on all (translated) pages that use the template.

See for example adding the language bar to the Lazarus DB Faq page.

Adding the language bar

This instruction describes adding the language bar to the Lazarus DB Faq page.

  • Edit the page by using the link "Edit" on the VIEWS panel.
  • To the top of the page add {{Lazarus DB Faq}}. This adds a link to the template page.
  • Save the page. You will see at the top: Template:Lazarus DB Faq highlighted in red.
  • Edit the page again. Scroll down to the bottom of page and you'll see the text "Templates used on this page: Template:Lazarus DB Faq" with a link to a (non-existing) template page. Click on it and this will show an empty template page, Edit the page using the "Edit" link on VIEWS panel and start to edit the template
  • Add the following content to the template page.
<small>
[[Lazarus DB Faq/de|'''{{#language:de}} (de)''']] 
[[Lazarus DB Faq | '''{{#language:en}} (en)''']]
</small>
The country code in the {{language:xx}} parameter is defined in ISO 639.
  • Add an entry for each translation. See for names the Main Page template, because that probably has the most translations. Note the "Lazarus DB Faq" is case sensitive.
  • Save the template page.
  • Now go to each translated page (in this case Lazarus DB Faq/de) and add {{Lazarus DB Faq}} to the top of the page.

Updating the language bar

Edit the template page, so that the new translation is added.

  • Go the edit tab of a page that has a new translation.
  • On the edit page you find a link to the used template. Click on it, to show it.
  • Edit the template page and add a link to the new translation.

A quicker way to get a language bar

Put the template {{MenuTranslate| page=Your_page}} on top of every new page (original or translated). This template searches the wiki for any translated pages to a given original. So you don't have to change a template by yourself.

Usage

See: Template: MenuTranslate

Remarks

There seems to be a minor flaw somewhere in the template. But if somebody could fix this, it is probably an easier, cleaner and more elegant way to add a language bar.