Help talk:Extension:Translate

About this board

Integrating English Articles with Polish URLs in MediaWiki

2
Jacekpoleszak (talkcontribs)

I'm managing a MediaWiki site with Polish as the primary language. However, we occasionally receive content in English that needs to be incorporated seamlessly into our site, including adopting Polish page titles/URLs without the "/pl" suffix typically used for translated content. For example, I wish to translate the title "My new page" from English to Polish and use it as the main content, ensuring the URL reflects the Polish version without indicating it's a translation. Our site primarily translates content from English (or Spanish) to Polish, displaying it in Polish by default. I'm looking for advice on how to manually mark these articles for translation and adjust their URLs to blend with our Polish content. Any suggestions on setting this up efficiently would be greatly appreciated.

Nikerabbit (talkcontribs)

That's not supported by the Translate extension because general solution is not possible due to naming conflicts. You can create redirects manually.

Reply to "Integrating English Articles with Polish URLs in MediaWiki"

Hide "Translate this page" link, or protect translations of page?

2
Summary by PKFP

Thanks for the reply. I guess I just found a good solution. I just edited the source code of the Main Page to: <languages/><translate><!--T:2--> <!--If you want to edit or translate the Main Page you have to edit or translate the sub-templates of Template:Main_Page--></translate>{{Main Page}} So editors and translators both get the hint.

PKFP (talkcontribs)

Hi, Our main page has the following source code: <languages/><translate></translate>{{Main Page}}. So there is nothing to edit or translate (except the title "Main Page") and people should edit or translate the template instead. Is there a possibility to hide the "Translate this page" link, so I can replace it with a link to the Template? Thanks.

Tacsipacsi (talkcontribs)

I don’t think there’s an officially supported solution for that, but I don’t think it makes sense either. You should decide whether you want the page to be translatable: if yes, the link shouldn’t be hidden; if no, the page shouldn’t be marked for translation. If nothing except for the title is translatable, then there is something that’s translatable: the title.

You have some options:

  • (Supported and IMO best solution) Merge the template into the main page
  • (Supported) Keep the link for translating the main page, add a link in wikitext to Special:Translate/page-Template:Main Page
  • (Unsupported, I recommend against it) Add the link in wikitext and hide the link for translating the main page itself using the CSS .mw-pt-translate-header { display: none; }

Am I the only one who thinks this sucks?

4
Manifestation (talkcontribs)

I just expanded the Setup section of FlaggedRevs, an extension that gave me lots of problems that could have been prevented with proper instructions.

I was taken aback by these <translate> tags. I did the best I could, but I have no idea if I broke something or did something wrong. Is this really the best way to make MediaWiki multilingual?

Nikerabbit (talkcontribs)
Manifestation (talkcontribs)

Thanks. User:Shirayuki has altered my edit and made it compatible with the translation system... I think.

I honestly have no idea how this convoluted system works. I can't make heads or tails of it. For example, what are these <!--T:[number]--> markers?

Nikerabbit (talkcontribs)
Reply to "Am I the only one who thinks this sucks?"

Importing translation content

2
MarblehorseNet (talkcontribs)

I manage an English wiki with 7,000 pages written in English. To enhance its bilingual nature, I've generated machine translations for all those pages. These translations are stored in text files located in separate subdirectories like "/translations/es" and "/translations/fr".

Right now whenever I import my text files into MediaWiki I use Manual:ImportTextFiles.php/, is there a certain namespace or formatting that I have to use to upload the translations?

Is there a way I can easily import these pages into the Translate Extension?

MarblehorseNet (talkcontribs)
Reply to "Importing translation content"
213.127.250.211 (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)
109.181.53.25 (talkcontribs)

Is there a way to stop the source language pages appearing in search results?


We end up with two sets of search results for the page in the source language, one with /en, and one without.

Reply to "Do we always need /en"

Can I reuse a translation unit multiple times on the same page?

4
Brochon99 (talkcontribs)

Hello! On the same page, there are 4 times the same sentence. Can I reuse the same translation unit, or do the translators have to translate the same sentence 4 times?

For future reference, someone had the same question 7 years ago, but maybe the devs created some kind of unit variable like <ref> that can be reused in the same page (example : <unit name=1$ />?

Thank you.

Nikerabbit (talkcontribs)

This is not currently a supported feature. There are some templates here and/or meta.wikimedia.org that allow referencing other translation units. Don't remember the exact names right now.

Pppery (talkcontribs)

On Meta it's m:Template:Tunit. Don't know about any similar templates on MediaWiki.org.

Want (talkcontribs)

Technically no problem, practically big problem, because in another languege may be identically TU tranlated in other sense, by context. I use templates with combination a contents of the translated pages very much. See for example page 1A and try change language of the interface to 'polski'. It's not finished page for now. It's only example, how can be generated content from translated pages by Template:svitek

Reply to "Can I reuse a translation unit multiple times on the same page?"

How do I use this for a non-Mediawiki website?

11
Dimpizzy (talkcontribs)

I see that the documentation says "It can be used to translate the content pages, the interface of the wiki and even other software products", but I can't find any information on how to set it up for my non-Mediawiki website.

Matěj Suchánek (talkcontribs)

I think it means you can use it to translate other software products, but you still need a dedicated wiki for this. See for example translatewiki.net.

Nikerabbit (talkcontribs)

That is correct. It only runs on MediaWiki, but you can translate various things with it.

Dimpizzy (talkcontribs)

Oh got it. Maybe I'll have the translatable parts of my website on a wiki just for the Translate extension, and the core of the website would use the MW API to get and insert the translated content into the website.


Edit: Oh, just realized that's what Matěj was referring to.

Dimpizzy (talkcontribs)

Could you provide an example link to a Mediawiki instance that is connected to translatewiki.net, which is used for software interface messages? For example, where is the wiki located that maintains all the translations for the software messages of Mediawiki itself?

Tacsipacsi (talkcontribs)
Dimpizzy (talkcontribs)

Oh ok, I thought translatewiki.net somehow pulled the messages to translate from another wiki hosted by Wikimedia or Mozilla, or whoever.

Tacsipacsi (talkcontribs)

There is no other wiki involved, translatewiki.net pulls the English messages and pushes the translations directly from/to Git (e.g. core repo).

Dimpizzy (talkcontribs)

Understood. Is there any guide on setting up a git repo and connecting it to translatewiki.net and/or a private wiki with the Translate extension?

Tacsipacsi (talkcontribs)
Dimpizzy (talkcontribs)

Ok, thank you!

Reply to "How do I use this for a non-Mediawiki website?"

Marking minor edits as not needing translation

3
Cheesycow5 (talkcontribs)

I couldn't find anything about this feature, and I think it would be useful. If I'm editing a page that is enclosed in <translate> tags, and in one part I am making significant content changes, and in another part, I am only fixing typos or grammar, it would be nice to be able to mark the minor edits as not needing a new translation, as typo or grammar fixes probably won't affect the translation and will just waste translators' time.

For example, it could be done by placing <minoredit> tags around the grammar fix, which the Translate Extension then deletes from the source, and then it makes sure to not display the edited unit as needing translating (unless, of course, it still has major edits that need translating from prior revisions or from a different part of the unit).

Nikerabbit (talkcontribs)

The re-translation flag is controlled by the translation admins when they review the changes to each unit and re-mark the page for translation.

Cheesycow5 (talkcontribs)

Oh ok, thanks, that does sound like it would work well for that purpose.

Reply to "Marking minor edits as not needing translation"

Different link on translated page?

4
MFischer (WMF) (talkcontribs)

Hi there! Question, how can I change the links (non Wikimedia) on a translated page? I am currently attempting to translate this page to German and for the German version I would like to add resource links in that language. While I am able to translate all the text, I am unable to change the links. Any help would be much appreciated. Thank you so much :)

MFischer (WMF) (talkcontribs)

This would also allow me to added correct resources in all the other languages. Thank you :)

Nikerabbit (talkcontribs)
MFischer (WMF) (talkcontribs)

Noted, thank you kindly!

Reply to "Different link on translated page?"

relation "revtag" does not exist

4
Justman10000 (talkcontribs)

Hi, after I installed that extension (translate), this comes up:

Sun Oct 30 18:50:24 CET 2022 debian mediawiki-public- Error 42 from TranslatablePage::getTranslatablePages, ERROR: relation "revtag" does not exist LINE 1: ...ablePage::getTranslatablePages */ rt_page FROM "revtag","...

Data are as follows:

Nikerabbit (talkcontribs)

Did you remember to run update.php after enabling Translate?

Possibly this is specific to PostgreSQL, which we are unable to test ourselves currently. A full query and stacktrace would be helpful.

Justman10000 (talkcontribs)

Did you remember to run update.php after enabling Translate?

Sure, otherwise only a whitescreen came!

Justman10000 (talkcontribs)
Reply to "relation "revtag" does not exist"