Help:Extension:Translate/Unstructured element translation/es

Esta página explica cómo hacer la traducción de mensajes personalizados de interfaces wiki un poco más manejable, con la extensión Translate. Se aplica a cualquier parte de la wiki que quieras proporcionar automáticamente en el idioma de la interfaz del usuario. El ejemplo típico es la barra lateral, porque puede haber sólo una, pero el mismo método se puede utilizar para la página principal, si quieres tener todas sus traducciones bajo el mismo título, o incluso para las plantillas. It applies to any part of the wiki which you want to automatically provide in the user's interface language. The most typical example is the sidebar, because there can be only one, but the same method can be used for the main page, if you want to have all translations of it under the same title, or even for templates.

Este método es aplicable también a contenido wiki donde la traducción completa de página no encaja, como las páginas pesadas en el marcado o plantillas, cuyo marcado no quieres exponer a los traductores. Todo esto gira en torno a mensajes de interfaz, o la palabra mágica $int, que permite incluir mensajes de interfaz en cualquier lugar donde se puede escribir wikitexto. Esta palabra mágica permite sustituir automáticamente el mensaje de la interfaz, ya sea estándar, personalizado o nuevo, en el idioma de interfaz del usuario. This all revolves around interface messages, or the magic word, that allows you to include interface messages anywhere where you can write wikitext. This magic word allows to automatically substitute the interface message, whether standard, customized or new, in the user interface language.

Se puede utilizar para llevar el poder de la localización automática de la interfaz del wiki al contenido de la wiki, pero no resuelve el problema para los usuarios anónimos, que no pueden cambiar el idioma de la interfaz predeterminado. Véase la nota sobre la extensión Universal Language Selector más abajo.

Comparado con la traducción de páginas, este método tiene algunas desventajas:


 * 1) MediaWiki developers usually discourage the usage of  because it fragments the cache. Instead of storing one cached rendered version of a page, when  is used it needs to be cached potentially in hundreds of different languages.
 * 2) It is harder to setup, requiring access to wiki configuration.
 * 3) There is no automatic tracking of outdated translations and completion statistics might be off when new messages are added or deleted.
 * 4) Only wiki administrators can add messages to the message groups and translate them. This means that the system is suitable only for pages which don't change often, or administrators will have a lot of work.

The good thing is that it works most of the time and you can still get the job done. There are two tutorials that provide examples of the common use cases. Before that there is a section which details how to set up a message group, something which is always needed when using this method.

Configuración
A server administrator must complete this step. The following snippet needs to be added to LocalSettings.php:

The message group id,, must be unique, so don't reuse the same id for multiple groups. The second parameter to the  constructor, , refers to the MediaWiki:Sidebar-messages page. The label is shown in dropdowns and other places where you can select a message group. The description is shown in Special:Translate. Those are the values you can and should change to what suits your wiki when adding a new custom message group.

Tutorial de barra lateral localizada
We assume that the setup step has already been done. Then you should follow the sidebar customization guide carefully. Let's assume the following simple sidebar was created:


 * sidebar-commonpages
 * FAQ|sidebar-faq

And MediaWiki:Sidebar-commonpages contains, while MediaWiki:Sidebar-faq contains.

Then all we need to do is to go to MediaWiki:Sidebar-messages (or whatever was defined in the previous step) and write there:

sidebar-commonpages sidebar-faq

That is, the names of the system messages, without the "MediaWiki:" namespace prefix, separated by whitespace.

Then go to Special:Translate/wiki-sidebar (or whatever was defined in the previous step; see Special:Translate for the list of defined groups). Now it is possible to translate the messages into other languages. Since all the messages are in the MediaWiki namespace, only interface administrators can edit the list of messages and actually translate them.

Tutorial de página principal localizada
Another use case is a page with lots of markup or templates. The advantage of this method is that the language automatically appears in the user's interface language. The drawback is that to change the language in which the page is displayed, the interface language must be changed.

La implementación es igual al del tutorial previo:


 * 1) Configura un grupo de mensajes nuevo.
 * 2) Toma una página wiki.
 * 3) Replaza cada parte traducible con  y mueve el contenido a MediaWiki:Mainpage-messagename.
 * 4) Ve a MediaWiki:Mainpage-messages (o a lo que se configuró) y agrega ahí los nombres de mensajes separados por espacios.
 * 5) Listo. Ve a Special:Translate para traducir la página principal.

He aquí un ejemplo. Supongamos que Main Page contiene:

 is a community for chefs and bakers that love chocolate. We currently have pages full of chocolate.

Luego cámbialo a:



Crea MediaWiki:Mainpage-slogan con el contenido:

is a community for chefs and bakers that love chocolate.

Crea MediaWiki:Mainpage-pagecount con el contenido:

We currently have pages full of chocolate.

Crea MediaWiki:Mainpage-messages con el contenido:

mainpage-slogan mainpage-pagecount

¡Listo! Puedes agregar o borrar mensajes cuando quieras.

Selector de idioma
Not only the user can't choose what localised version of the page to read unless changing their preferences, but anonymous users can't set their user interface language and always use the wiki's default language. A page translated with this system will be in the default content language, if you don't provide anonymous users a way to select their language.

Luckily, there is a solution. With the extension it is possible to guess the user's preferred language and also to let the user manually select another language and store the choice in a cookie, with no need of tricks such as the   parameter, which is suitable mostly only for debugging.