Jump to content

Topic on Project:Support desk

What are the possible ways to translate in MediaWiki without an extension?

10
2001:44C8:414F:134D:C5CF:2A00:98E4:CD1D (talkcontribs)

I use only one extension - ContactPage.

Using the template engine HTMLForms implemented as form-template for ContactPage I created a selection menu in my form.

The keys and values of this selection menu are written in English inside LocalSettings.php

But,

I would like them to appear in my site's native language for surfers.

I could translate these extensionless with JavaScript by some similar code:

document.getElementById('select').selectedIndex = 0;

document.getElementById('select').value = 'Default';

In the Drupal CMS for example, there is a "backend" internal translation mechanism that allows to do just that, but I don't know of a similar internal mechanism in MediaWiki.

I wonder how you would do it "backend" and extensionless:

What are the possible ways to translate in MediaWiki without an extension?

Ciencia Al Poder (talkcontribs)

Usually, in many places you can use <code>{{int:message name}}</code> to transclude the contents of MediaWiki:Message name in the language requested by the user (that can change by an extension or by adding uselang=languagecode to the URL). You can try this approach and see if that works. You'll have to create each message in every language you want translated: MediaWiki:Message name (default), MediaWiki:Message name/de (German), MediaWiki:Message name/es (Spanish)...

2001:44C8:414F:134D:C5CF:2A00:98E4:CD1D (talkcontribs)
Ciencia Al Poder (talkcontribs)
2001:44C8:4704:4BA9:A8F5:BA5E:107:AFAE (talkcontribs)

In my opinion it might not @Ciencia Al Poder ; anyway, sadly I read the part about system-messages transclution but I misunderstand what it means.

Thanks,

Ciencia Al Poder (talkcontribs)

You can create new pages on the MediaWiki namespace that don't exist already, and use that for your own messages. Then transclude them on the template you were talking about (with the int: prefix as described in the help page). You'll need to create one for the main language of the wiki, and subpages for every language you want the message to be translated.

2001:44C8:4360:F937:D041:643C:BF0A:58C6 (talkcontribs)

Now I understand what should be done (especially the namespace: example helped me so. Thank you.

2001:44C8:4360:F937:D041:643C:BF0A:58C6 (talkcontribs)

For newcommers, more information is available in the StackOverflow session with the title:

What are the possible ways to translate in MediaWiki from “backend”, without an extension?

It could be found in a quick Google search --- the strict "anti spam" filter here didn't let me post a link peacefully.

2001:44C8:4360:F937:D041:643C:BF0A:58C6 (talkcontribs)

I ask @Ciencia Al Poder to help with this problem (and may the spam filter finally be softened to allow StackOverflow questions containing the term "mediawiki").

Ciencia Al Poder (talkcontribs)
Reply to "What are the possible ways to translate in MediaWiki without an extension?"