Template:Babel/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a documentation subpage for Template:Babel.
It contains usage information, categories and other content or metadata that is not part of the original template.

Basic usage for languages

The simplest use of {{Babel}} is a variation on the form {{Babel|en|de-1|fr-1|pt-1}}. This format begins with the name of the template, followed by a pipe (|)-delimited list of language codes, each code optionally qualified by an experience level; the experience levels are described in detail at Wikipedia:Babel, but briefly the range is from 0 to 5 for increasing levels of proficiency, with no qualifier indicating you are a native speaker.

This results in categorization of language proficiency categories, see Category:Users by language (e.g. Category:User en-3).

Until 2023 there was a second type of translation matrix categories (e.g. Category:Users pt en-3). This is now inactive.

Best practice in ordering language codes

The following is suggested best practice to maintain maximum utility of the content of Category:Translation matrix:

  1. put native languages first, in alphabetical order
  2. put other languages following native languages, in decreasing numerical order of experience
  3. for multiple languages at a particular numerical order of experience, alphabetize those language codes

Thus, {{Babel|ru|pt|es-1|fr-3|en-3}} does not abide by any of the three suggested rules.

The format which does abide by all three rules would be {{Babel|pt|ru|en-3|fr-3|es-1}}.

Babel boxes

Your Babel box is for showing the languages that you know, as well as the operating system, keyboard layout, web browser, desktop environment, and text editor that you are most comfortable with. Details of how to use it for its original purpose -- showing the languages that you know -- are at wikipedia:Wikipedia:Babel.

  • Template:Babel - Allows 1 to 100 boxes.
    Format: {{Babel|<box1>|<box2>|<box3>...}}

Passing parameters to included user boxes

The trick is to use the {{!}} template. See below for an example.

User boxes from the "User:" namespaces

The Babel box prefixes its arguments with "User ", so it will work with the User: namespace. For example, this would include the {{User:Urhixidur/Userboxes/Asteroid}} user box, and pass it a parameter as well:

{{Babel|<box1>|<box2>|:Urhixidur/Userboxes/Asteroid{{!}}<parameter>|<box 4>|...}}

Custom headers, footers etc.

To customize the appearance you can add the optional parameters header=HEADER (default: Wikipedia:Babel), footer=FOOTER (default: Search user languages), bordercolor=BORDERCOLOR (default: #99B3FF), color=COLOR (default: white), textcolor=TEXTCOLOR (default: black), left=Left margin (default: 1), bottom=Bottom margin (default: 0.5), solid=Solid border width (default: 1), width=Box width (default: 248), and/or extra-css=<any other formatting>. Call the '!' userbox to start a new column after that point or the '-' userbox to insert a blank row. You may also use '|align=left' to display the babel box on the left side of the screen rather than the default right. Boxes with parameters can be added at the end with the format, "|special-boxes={{box page name|param1|param2}}{{second page name|param1|param2|param3}}". Any number of additional boxes can be added this way and will display below the others.

Example: {{Babel|color=yellow|align=left|de|en|!|fr|ru}} produces:


Babel user information
de-N Dieser Benutzer spricht Deutsch als Muttersprache.
en-N This user has a native understanding of English.
fr-N Cet·te utilisateur·rice a pour langue maternelle le français.
ru-N Русскийродной язык этого участника.
Users by language


How to get Babel boxes to work on other Wikipedias

The page you are now reading is the actual Babel template. If you click "edit this page", you will see a bunch of computer code that makes the Babel boxes work. What you're now reading is just comments in that code, inside "<noinclude>" tags so it doesn't interfere with the computer code.

In order to have Babel boxes on another Wikimedia project, just copy this page to that project. Click "view source" and use your computer mouse to copy all the contents, including the computer code. Create a page called "Template:Babel" on the other Wikimedia project and put the content into it.

You also need to copy over a bunch of files with names like "Template:User en", "Template:User en-1", "Template:User fr", etc. etc. Once you've done that, users can put e.g. "{{Babel|en-1|fr}}" on their user page and the Babel boxes will be displayed.