Help talk:Extension:Translate

Jump to navigation Jump to search

About this board

Multilanguage import and translate

AssetDenmark (talkcontribs)

I have a 'practical' question, but i am not sure where to put it - please direct me elsewhere if this is not the correct "talk" page…

I setup a new Wiki (V1.30) on a NAS and I want to import all of a old (V1.81) Wiki - located on a PC.

The 'source language' for the wiki is 'da' (Danish), but I want to add en' (English) as an option - so I guess that i need to prepare a bit to get that right…

I have some 2-400 Wiki pages of English text… that I want to import and then translate. For that I need to import the pages to say wiki/n1:whatever/en - but when I translate this, to 'da' ,will that then end up in \whatever\dk or will it go in \whatever… ?

Furthermore - I need to split up these pages into namespaces (like, n1:, n2:, n3:… say I will have a name space like this: wiki/n1:whatever\en

My general questions are:

  • Can I somehow import texts to land in the "correct" place...
    • wiki/n1:whatever1/en
    • wiki/n1:whatever2/en etc.

When i translate from the /en version, where will this end.. and will the Wiki work with a mix of /da, /en and <source language> pages…  what happens if there are the following page combinations at the same time:

wiki/n1:whatever1/en the english page

wiki/n1:whatever1/da page in danish

wiki/n1:whatever1 - standard name for the 'n1:whatever1' page, should also be in Danish

p.s. I did this interface to goggeltranslate at some time in the past.

Nikerabbit (talkcontribs)

I would do it like this:

  1. Import all English pages into the wiki in a way you want (no language codes in the page names)
  2. Mark them translatable
  3. "Translate" them to English by just copying the source text
  4. Translate the source text page into Danish manually
  5. Re-mark the source page for translation
  6. Mark the English translations as non-fuzzy
AssetDenmark (talkcontribs)

Naturally! Clever.. :-) - could have thought about that, but would I have.. before it was too late?

Than How do I handle the 'da' language tags - the "source languag" will be Danish, so can I simply translate to a page "without" the page name language code? Over time the wiki would probably contain a mix of no-tag, da and en - but can I do anything to prevent that from happening...

I guess I could leave out the 'da' option all together.. but will that create oher issues?

Nikerabbit (talkcontribs)

The system will create /en and /da pages for you. There will be no automatically generated links to /da, because links to that language will point to the page without language code.

Reply to "Multilanguage import and translate"

Existing translations must be moved

Perhelion (talkcontribs)

I mean this is one of the main reasons why this extension not get wider used, because there is no function to do this simple time consuming work. Normally there exist already around 20 target subpages e.q. on Commons. So it's not fun to use it. Maybe use Extension:Replace Text.

Perhelion (talkcontribs)

PS: Beside the fact we can't move any page under i18n/ if the page /i18n exists (so we must delete them first?).

EDIT: That was a very bad idea from me [[phab:T114592]] (<-- I love this flow)

Nikerabbit (talkcontribs)

It is not clear whether you mean existing non-Translate translations (for that use Special:PageMigration) or renaming pages (use the move action), but both are supported with some known issues.

Perhelion (talkcontribs)

Thanks for answer, there is a serious problem on Template:Mozilla Public License/(after moving, which was unnecessary in my opinion too). I edited the /i18n subpage again to refresh the ext.translate (bot), and now any language got overwritten with English (I guess restoring the "bot deletion" was a very bad idea). I really do not feel like re-entering each language manually. An undo of Move or something would be very good!? PS:Maybe a detailed documentation, what is going wrong here, would be good too.

PS: I trying the Special:PageMigration thing, but I got an JS error on the page (nothing happen). I guess it comes from "mediawiki.searchSuggest" (Uncaught TypeError: Cannot read property 'indexOf' of undefined)

Nikerabbit (talkcontribs)

I'll look into these errors later when I have time. Perhaps there is easy way to restore the translations.

Reply to "Existing translations must be moved"
Lyrixn (talkcontribs)

On a wiki project I'm working on, I've had an issue for a while, where Special:MyLanguage doesn't redirect properly and instead shows me someone else's version of a cached/static article.

E.g. if it's a logged out user, it shows me a static of being logged out and if I stumble upon a registered user's static, then it will display me as if I'm logged in as someone else.

Any ideas how to fix this? Because currently I'm unable to utilize Special:MyLanguage as its intended purpose. It's more of a burden, than of help.

Nikerabbit (talkcontribs)

First of all, Special:MyLanguage has been in MediaWiki core for some time. Secondly, it sounds like you have a frontend cache that is not properly configured. I've never seen MediaWiki give out pages intended for some other use.

Reply to "Requirements for Special:MyLanguage" (talkcontribs)

When we mark a page for translation it always generates the /en language which is the same as the source. Can this be switched off or is it a requirement? If the latter, please indicate this clearly in the documentation. (@Wimjongman)

Wimjongman (talkcontribs)

[22:17] <wimjongman> Does the translate module always need the /en language even if this is the source?

[22:28] <Nemo_bis> wimjongman: only if it's the source

[22:31] <wimjongman> So if english is the source I cannot block the /en generation?

[22:34] <Nemo_bis> wimjongman: with sufficient effort you might be able to break it, but are you sure you understand the consequences?

[22:34] <Nemo_bis> What are you trying to achieve?

[22:36] <wimjongman> Nemo_bis: I just want to understand if this is the intended behavior.

[22:38] <Nemo_bis> wimjongman: yes, it is

[22:39] <Nemo_bis> The subpage is needed so that all language codes are treated equally and so that a version of the page without Translate's markup is always available

[22:39] <Nemo_bis> Without the /en subpage, you would not really be able to make templates translatable, for instance. The subpages are what gets transcluded

[22:42] <wimjongman> Nemo_bis: I understand. Thanks. Another thing is that our translators have found the Special:MyLanguage tag and starting to put that in the source pages. Is that best practice?

[23:16] <Nemo_bis> wimjongman: yes, we currently have no way to redirect links to the correct page without wikitext changes

[22:46] <wimjongman> Nemo_bis: is SpecialMyLanguage needed in combination with $wgTranslatePageTranslationULS?

[23:16] <Nemo_bis> $wgTranslatePageTranslationULS only works for the first click

Nikerabbit (talkcontribs)
Reply to "Do we always need /en"

Is it possible to disable the split in units?

ClemFlip (talkcontribs)

Hi Friends,

I'd like to know if it's possible to disable the auto split in units?

When the page is mark for translation, the system will insert tags like inside the wiki-text.

I'd like to avoid that, so that the entire text inside the <Translate> tag will be translated in one string (Even if there is a hard return inside the <Translate>).

I hope I am clear. Thanks a lot for your help.

Quiddity (WMF) (talkcontribs)

Hi. Could you give us a link to the page you're working on, so that we can understand the use-case/problem you're trying to solve?

And/or, paste the content (or similar) into a sandbox? (Feel free to use User:Quiddity (WMF)/sandboxtranslation).

ClemFlip (talkcontribs)

Hi @Quiddity (WMF), thanks for your quick reply.

Unfortunatly, I can't share a link with you since I am working on a local environment.

However, on the sandbox, if you switch to the wikitext edit mode:

You can see that






,... have been inserted inside the wikitext to split all the content inside <translate> and </translate> into translatable strings (Witch is fine).

However, on my wiki, when I switch to the VE edit mode, I see little grey mark that looks like !T:2 in lieu of the


tag (witch is not very convenient for the user).

On the sandbow, however, those little marks don't seems to show up. Is it something that as been solved in a new version of VE maybe?


Another question, is their a way to simply disable the auto split? (so disable the fact that the extension automatically insert






into the wiki-text)

Thanks a lot.

Quiddity (WMF) (talkcontribs)

Re: Visual editor - no, I'm afraid that editor does not currently support Extension:Translate (which is an old and complicated extension).

Re: merging all "translatable units" into a single unit - I don't think so, beyond using <br> at the end of every line. (Which I strongly advise against) -- The extension is designed to make it easy for various people to do "little bits, one at a time" (So if they get bored or busy, halfway through the work, then at least some of the page is translated); therefor, to have "multiple paragraphs all in a single translation unit" isn't possible (as far as I know, and I cannot think of any other hacks/workarounds to make it do that). Sorry, but hope that helps.

Reply to "Is it possible to disable the split in units?"

Can't import .po files on my setup

Tuxxic (talkcontribs)


I am using Special:ImportTranslations to import .po translations from offline translators.

When I import them, I can "Execute" (see screenshot)

But when I go to my page, the translations are not taken into account.

What do I do wrong ?

StefanN91 (talkcontribs)

Hey there,

@Tuxxic the same thing is happening in my wiki setup. It would be realy nice if you could share your solution to us.

Did you already solved this Problem??? I realy need to now.

Tuxxic (talkcontribs)
StefanN91 (talkcontribs)

Thanks for your help. I'm going to use the poimport.php script and see if I works.

Do you know if someone is working on that problem?

Tuxxic (talkcontribs)
StefanN91 (talkcontribs)
Tuxxic (talkcontribs)

Aha ! Thanks for help, we get closer to the perfection as patches are put !

Reply to "Can't import .po files on my setup"

Automatically switch to reader's preferred language if it is available.

Mjamesderocher (talkcontribs)


I want the page to automatically show the translation for the user's selected laguage if the page is available in that language. I see that on the Extension:Translate page, if I switch my language to Spanish, then it automatically loads the Spanish translation of the page, but on my site it does not do the same thing.

Is there a setting that I need to change?

Nikerabbit (talkcontribs)

Yes there is. It is called $wgTranslatePageTranslationULS.

Reply to "Automatically switch to reader's preferred language if it is available."

How can I make <languages /> appear in MediaWiki:Sitenotice?

JamesPoulson (talkcontribs)

The idea is to have the languages links appear on all pages.

If you have any alternative suggestions then I'm interested.

Nikerabbit (talkcontribs)

Not possible with Translate extension. The sitenotice does not know which translations exist. I am not sure it even knows which page it is displayed on, but if it does, you could make your own template that mimics the look of the language box.

Reply to "How can I make <languages /> appear in MediaWiki:Sitenotice?"
Kghbln (talkcontribs)

Hmm... which page is canonical for e.g. search engines. I have an English language source page and an English language subpage with /en. Well this does not just apply to search engines: Which English language page is supposed to be served to users?

Nikerabbit (talkcontribs)

Currently, the /en (or whatever is the source language) is only there to be used for transclusions (Template:TNT for example).

Kghbln (talkcontribs)

Well all languages should be treated equally so the /language code pages are the once to be served to the audience. Still not sure what search engines like Google make of it and what this means for sitemaps

Kghbln (talkcontribs)

Ah, did not see Nike's post.

Reply to "Canonical page for source language"

How to translate category labels

Kghbln (talkcontribs)

I have this on my page:


and I get


does help at all since the result is the same as above. However since I cannot expect English speaking people to know what "Beispiele" means the only way is seems to label the category.

This may be a noob question. I am sure there is a way but I currently do not get it. This example does not cover it so I am a bit lost.

Nikerabbit (talkcontribs)

Currently, as far as I know, MediaWiki does not support changing category names from what they actually are. There is a task requesting to support this: task T26139.

Tuxxic (talkcontribs)

@Nikerabbit : has plans changed on this task by any chance ? Because in fact this is what I request in my comment below.

Nikerabbit (talkcontribs)

I am not sure why you are asking me. My priorities are currently elsewhere.

Tuxxic (talkcontribs)

Sorry, I did ask because I thought you were in charge of this task.

I will wait to see it resolved or - better! - try to solve it myself when I get familiar with MediaWiki code.

Anyway you are always of good advice, and you helped me a lot. Thank you !

Kghbln (talkcontribs)

Ouch, admittedly I have never labeled a category differently. I took it for granted that this is possible. I guess this will be a nice feature with regard to content translation. Thanks a lot for pointing to the issue.

Andreas Plank (talkcontribs)

Just an idea: one could try to transclude the translated content of the page display title of the corresponding Translation name space page:

{{#ifexist: {{Translations:Kategorie:Beispiel/Page display title{{#translation:}}}}<!-- 
then transclucde content via {{…}}
-->|{{Translations:Kategorie:Beispiel/Page display title{{#translation:}}}}<!-- 

… or in general with the magic word {{FULLPAGENAME}}:

{{#ifexist: {{Translations:{{FULLPAGENAME}}/Page display title{{#translation:}}}}<!-- 
then-->|{{Translations:{{FULLPAGENAME}}/Page display title{{#translation:}}}}<!-- 
Andreas Plank (talkcontribs)

I just realized (for the record so to say) that the page I’m testing in #ifexist: must be coded correctly as Translations:… and not as page transclusion {{Translations:…}}:

{{#ifexist: Translations:{{FULLPAGENAME}}/Page display title{{translation:}}<!-- 
then -->|{{Translations:{{FULLPAGENAME}}/Page display title{{translation:}}}}<!-- 
else -->|{{FULLPAGENAME}}
Kghbln (talkcontribs)

Thanks for your suggestion. The idea I came up with is to do

<translate>Categories:</translate> [[:Category:General{{#translation:}}|<translate>General</translate>]]


and add the HIDDENCAT behaviour switch to "Category:General{{#translation:}}". This is a bit of work depending on how many categories there are as well as make the display of the category link [[:Category:General{{#translation:}}|<translate>General</translate>]] appear as if the added category was never hidden but I quite like it.

Tuxxic (talkcontribs)


I came upon this help topic and it helped a lot.

I need to do a slightly different thing than @Kghbln : my goal is to have the translated category name, but point it to the translated link

Like "Catégorie:Blanc" displays "Catégorie:White" but points to "Catégorie:Blanc/en"

Reply to "How to translate category labels"