Template:Babel: Difference between revisions
Minh Nguyen (talk | contribs) (Synchronized w/ d:Template:Babel (1553646956)) |
Minh Nguyen (talk | contribs) (Commented out annoying template redundancy warning per request at User talk:Minh Nguyen#Babel template; the template works fine, even if it is extraneous these days) |
||
Line 1: | Line 1: | ||
{{Warning|Please do '''not''' use this template. Use <code><nowiki>{{#babel:...|...}}</nowiki></code> instead!}} |
{{Warning|Please do '''not''' use this template. Use <code><nowiki>{{#babel:...|...}}</nowiki></code> instead!}} |
||
<onlyinclude><span style="float:right;">Please use <code><nowiki>{{#babel:</nowiki>{{#if:{{{1|}}}|{{{1|}}} }}{{#if:{{{2|}}}|{{!}}{{{2|}}} }}{{#if:{{{3|}}}|{{!}}{{{3|}}} }}{{#if:{{{4|}}}|{{!}}{{{4|}}} }}{{#if:{{{5|}}}|{{!}}{{{5|}}} }}<nowiki>}}</nowiki></code> instead of this template!</span> |
<onlyinclude><!-- <span style="float:right;">Please use <code><nowiki>{{#babel:</nowiki>{{#if:{{{1|}}}|{{{1|}}} }}{{#if:{{{2|}}}|{{!}}{{{2|}}} }}{{#if:{{{3|}}}|{{!}}{{{3|}}} }}{{#if:{{{4|}}}|{{!}}{{{4|}}} }}{{#if:{{{5|}}}|{{!}}{{{5|}}} }}<nowiki>}}</nowiki></code> instead of this template!</span> |
||
{{#babel: |
-->{{#babel: |
||
|{{{1|}}} |
|{{{1|}}} |
||
|{{{2|}}} |
|{{{2|}}} |
Latest revision as of 08:22, 31 July 2023
Please do not use this template. Use {{#babel:...|...}} instead! |
Babel user information |
---|
Users by language |
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
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 simplest form of template use results in categorization to two types of User categories: single-language proficiency categories (e.g. Category:User en-3) and translation matrix categories (e.g. Category:Users pt en-3). The order of the language codes impacts the categories invoked. Thus, {{Babel|pt|fr-3|en-3}} results in categorization to [[Category:Users fr-3 en-3]] while {{Babel|pt|en-3|fr-3}} results in categorization to [[Category:Users en-3 fr-3]].
Best practice in ordering language codes
The following is suggested best practice to maintain maximum utility of the content of Category:Translation matrix:
- put native languages first, in alphabetical order
- put other languages following native languages, in decreasing numerical order of experience
- 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}}.
Limitation of combinatorial category creation
Up to five languages will be interpreted properly so that all pair-wise combinations of languages will be represented in applied categories. For six or more languages, you will need to manually add additional binary-language categories to be fully represented in the Category:Translation matrix. An example of this appears at an old version of GatoSelvadego's user page.
Note that combinations with level 0 for languages in any tested pair (language not understood) are automatically excluded.
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>|...}}
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 | |||||
---|---|---|---|---|---|
|
| ||||
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.