User:Suruena/i18n (en)
i18n ≈ Iиtεŕйâtiøńåłïžatíòñ
Other languages: English (English) | español (Spanish) | +/-
The abbreviation i18n means Internationalization. At this page I'll explain some ideas that could help the Wikimedia projects. It's a work in progress so I still have to write a lot. If you want to point me something or propose some alternative, write a comment at the talk page.
Internationalizing templates
editTemplates, I love templates! Templates are simply subpages located at the domain name Template:
that have the property that wherever you write its name within double curly brackets ({{example}}
) the server will replace it with the text of that page. Templates can be used for a lot of things. For example:
- Unification of contents
- To share contents, and this means more information with less work
- Easing changes, for example to fix an error or to change the presentation
- To write less (e.g. instead of writing
<span lang=es>El Quijote</span>
, writing{{lang|es|El Quijote}}
)
Templates of language names
editOther important templates are those used at the Meta-Wiki main page for listing the different languages of a project, for example of the Wikipedia. This template has the list of Wikipedia's versions, and each link is the language name (the native name) with the English translation. This template is used in the main page of all Meta-Wikis, so every time somebody adds a new link to the template all main pages are updated automatically. Thus changes are faster because it is not needed to wait until every main page includes the change, and above all a lot of effort is avoided because it is not needed to change every page by hand.
However, these templates aren't really international because they are only translated to English. Every main page should have the translation of the names of the different versions in its own language, and not only in English. For this purpose I've created some generic templates (templates are always the answer! :-) that have a parameter to specify the desired language. For example, the template List of Languages can show the translation of the name in the specified language. First we want the English list, writing the next code
{{List of Languages|lang=en}}
we will see the next list:
- Afrikaans (Afrikaans)
- العربية (Arabic)
- azərbaycanca (Azerbaijani)
- български (Bulgarian)
- brezhoneg (Breton)
- čeština (Czech)
- dansk (Danish)
- Deutsch (German)
- Ελληνικά (Greek)
- English (English)
- español (Spanish)
- Esperanto (Esperanto)
- فارسی (Persian)
- français (French)
- گیلکی (Gilaki)
- עברית (Hebrew)
- italiano (Italian)
- 日本語 (Japanese)
- қазақша (Kazakh)
- 한국어 (Korean)
- kurdî (Kurdish)
- مازِرونی (Mazanderani)
- Nederlands (Dutch)
- norsk (Norwegian)
- polski (Polish)
- português (Portuguese)
- русский (Russian)
- српски / srpski (Serbian)
- svenska (Swedish)
- українська (Ukrainian)
- 中文 (Chinese)
- अवधी (Awadhi)
Now suppose we want to see the list in Spanish, so we only change the parameter
{{List of Languages|lang=es}}
and that's it!:
- Afrikaans (afrikáans)
- العربية (árabe)
- azərbaycanca (azerbaiyano)
- български (búlgaro)
- brezhoneg (bretón)
- čeština (checo)
- dansk (danés)
- Deutsch (alemán)
- Ελληνικά (griego)
- English (inglés)
- español (español)
- Esperanto (esperanto)
- فارسی (persa)
- français (francés)
- گیلکی (Gilaki)
- עברית (hebreo)
- italiano (italiano)
- 日本語 (japonés)
- қазақша (kazajo)
- 한국어 (coreano)
- kurdî (kurdo)
- مازِرونی (mazandaraní)
- Nederlands (neerlandés)
- norsk (noruego)
- polski (polaco)
- português (portugués)
- русский (ruso)
- српски / srpski (serbio)
- svenska (sueco)
- українська (ucraniano)
- 中文 (chino)
- अवधी (avadhi)
How does this list work?
editThe template Template:Lang def does all the dirty work. See an usage example of this template:
{{Lang def|code=es|lang=en}}
This wikicode will be replaced by the following:
español (Spanish)
As you can see, the Template:Lang def template has two input parameters: The language code (to specify the language name), and the language you want it to be translated. If you see the source of the List of Languages template you will see the following:
... * {{Lang def|code=en|lang={{{lang}}}}} * {{Lang def|code=es|lang={{{lang}}}}} * {{Lang def|code=eo|lang={{{lang}}}}} ...
It is no more than a succesion of occurences of the template Template:Lang def that receive as the code paramenter the set of languages that appears in the list, and as the second paramenter the language received as the lang parameter the template Template:List of Languages (after all we want that all the language names of the list be translated to the same language).
And finally, there are some templates for the names of the languages and for the translations that are "called" by Template:Lang def. They look like this:
{{Lang name - code}} {{Lang name - code (code)}}
where code is the language code (I'm using ISO 639-1, but in the future it could be not enough). For example:
{{Lang name - es}} Español {{Lang name - es (en)}} Spanish
Now that you know how it works feel free to translate the language names to other languages or to add to this list other languages if you want (don't bother if you only translate your new addition to one or two languages, in the future somebody will help to finish the translations). After saving the template, when you reload this page you will see two links to non existing templates. Simply click in the first link and write the native name of the language, and later click in the second link and write the corresponding translation of the name. To tranlate the list of languages names to your language simply edit the talk page, write {{List of Languages|lang=code of you language}}
, and click at every link to translate their names to your language. After that anyone will be able to use this list in other pages in that language.
Scalability
editNow we have our templates completely internationalized. Now suppose that a wiktionary in a new language has born, and its creators add a link to the template of active wiktionaries (using the templates of language names). Automatically it will appear in the main pages of every Meta-Wiki translated to the correct language at no cost (well, the corresponding templates should exist, but this is very likely because it is almost sure that there was a Wikipedia version in that language). It is a very scalable solution.
Conclusion
editI only see one problem: maybe using these templates is more difficult than plain links, and it's very importante that everyone could be able to contribute to the projects. We would need more documentation and teach the users how to use templates, o maybe there are other ways to do the same. But the conclusion is that there are powerful methods that can help in the development of the projects, and we should use they.
Another example
editAnother usage example of these language name templates is the menu of translations at the top of this page:
{{Menu of translations|trans=Suruena/i18n/Languages|lang=en}}
Actually the template that uses the language names is Template:Suruena/i18n/Languages (passed to Template:Menu of translations as a parameter. This one only shows a localized message and the contents of Template:Suruena/i18n/Languages).
Active Wiktionaries
editLets see one solution for our mentioned internationalized template with the list of active Wiktionaries. It should looks like the following another snippet of code:
... * [[:wiktionary:en:Main Page|{{Lang def|code=en|lang={{{lang}}}}}]] * [[:wiktionary:es:Portada|{{Lang def|code=es|lang={{{lang}}}}}]] * [[:wiktionary:eo:Ĉefpaĝo|{{Lang def|code=eo|lang={{{lang}}}}}]] ...
The template receives one parameter to specify to what language the names will be translated, pointing every link to a version of the Wiktionary. When using the template within a English page it will look like this:
...
...
and when called with the "es" language code it will translate the names to Spanish:
...
...
Short forms
editThanks to TheDJ and Patrick for providing the following templates:
- {{Lang name|code=code}}
- {{Lang name (code)|code=code}}
- {{Lan|code}}
The first is a new form for the language name, and the second is a new template that shows the language name and also the language code code. Both were contributed by TheDJ. The third was created by Patrick and is a short form for the second template. Some examples:
{{Lang name|code=nl}} Nederlands {{Lang name (code)|code=nl}} Nederlands (nl) {{Lan|nl}} Nederlands (nl)
{{Lang name|code=eo}} Esperanto {{Lang name (code)|code=eo}} Esperanto (eo) {{Lan|eo}} Esperanto (eo)
Sharing templates
editThere are some templates that are very helpful and should be shared between different projects and languages. For example:
- {{lang|lang|text}}: to indicate that this text is in the language lang (HTML tags).
- {{edit|page|text}}: creates a link to edit page with the title text.
TBD
No more "Edit this"
editSome common templates should be used from any language, but some of them include text in English. Sometimes they could be replaced by a neutral text, for example "Edit this template" with "+/-" (always do this).
TBD
Interlanguage links
editAs I said before, the Wikimedia projects are very rich in the sense that there are versions of every project in several languages. But there are so manys that when a page is translated in a lot of languages isn't easy to found the link to the desired translation, for example. For this reason interlanguage links should be always sorted. This is specially important in shared projects like Meta-Wiki.
There are many ways for sorting interlanguage links. I'm not going to propose another one, but to use a centralized list of languages that stablished the desirable order for interlanguage links. I propose to use the Template:List of Languages as the master list that provides all the languages used in the projects, and the "oficial" order of the languages. This way contributors (or bots, or MediaWiki itself) could sort the interlanguage links in a consistent manner, so users browsing the Meta-Wiki, for example, always will found a uniform interlanguage links order.
Maybe in different cases the list of interlanguage list should be sorted in different ways, but this is a start point. Also, it is a good idea to register all the languages names used in the projects, and its translations the other languages.