Extension talk:Translate

About this board


Hide translated page until 100% reviewed

Derf Jagged (talkcontribs)

Is there a setting to hide translated pages from non-translators until they are 100% reviewed? I'd like to have all pages reviewed by at least one other person before going "live".

Pardon if I'm missing something obvious, I scrubbed through the various help pages and couldn't find anything indicating that it's a feature.

Tacsipacsi (talkcontribs)

I don’t think it’s currently possible, and while it seems reasonable at first sight, there are some potential issue with it:

  • What does “hide” mean? Since translations are wiki pages, you can’t really make them entirely disappear for “non-translators” but still appear for translators (the page either exists or doesn’t exist). It could be hidden from the language selector (and there’s precedent for that: a similar but not configurable hiding was recently removed in phab:T359974) – is this what you mean?
  • What if a page used to be 100% reviewed, but is no longer? For example because someone edited a translation (maybe just a typo fix), or because the source page changed (which could even be a complete rewrite). Should the page disappear? The answer is probably “it depends”, which is not necessarily something that can be implemented in the program code. (And even if the answer is a definite no, that complicates things quite a bit compared to a definite yes, as it’s not enough to track the current state, the historical state needs to be tracked too.)
Derf Jagged (talkcontribs)

Thanks for the reply.

  • Yes, hiding it from the language selector is what I meant.
  • If the source page is updated, it would be put in the untranslated queue as normal and the existing translated pages would still be considered 100% reviewed since all the actual translations so far are reviewed. I believe this is how it's treated currently (I just tried it). But yes, that's a good point about the consequence of making a whole page hidden just because a translator made an update to their translation or translated a newly added source section.

I suppose the best implementation would be

  1. In the case of the initial translation of a page, hide the page from the language selector until there's at least one reviewed piece of content on the translated page.
  2. If a translation is updated or a new translated section added, show the old state of the section until the new one is reviewed. But you're right that it'd be much more complicated on the backend.

Anyway at this point, I suppose it's a pipedream feature request since it sounds like there's not really a system in place currently and it's beyond my skills to add. I appreciate the brainstorming/idea exercise nonetheless :)

Reply to "Hide translated page until 100% reviewed"
NGC 54 (talkcontribs)

I use the Translate extension very often, but many messages are hard to be translated because of the lack of syntax highlighting (like in Extension:CodeMirror). Could syntax highlighting be integrated in the Translate extension?

Tacsipacsi (talkcontribs)

I find syntax highlighting useful on pages with heavyweight syntax like large commented-out blocks, templates and magic words embedded at multiple levels or many HTML/XML tags. None of these should normally happen in translation units (complex syntax should be either outside of the translation unit or within <tvar>s). If a particular message has heavy syntax, you can always click on Show in wiki editor and use syntax highlighting there. I’m not strictly against highlighting on Special:Translate, but I don’t see much point in it, and if it does happen, I’d like it to be separately toggleable from the regular editor.

NGC 54 (talkcontribs)

Pages like this or this are very syntax-heavy and it is hard to identify the text that has to be translated. The same happens sometimes on Translatewiki.

Jdforrester (WMF) (talkcontribs)

Those are both good examples of what @Tacsipacsi is saying – the pages have been inappropriately marked up for translation with very large units that are hard to translate. This is less a problem with Translate as a tool, and more a problem with the way the tool is being used.

Reply to "Code Mirror"

Maybe also a Cache Issue (or /i18n issue)?

W like wiki (talkcontribs)

Hello, I wanted to make a small layout edit (link in bold text) to c:Template:Global maintenance category but it doesn't work. Since there is no "/layout" subpage I did my edit on the "/i18n" subpage, but it doesn't work. Strangly my edit some times before on the same subpage was working. Does someone has an idea why? Is this a cache problem or has it sthg to do with /i18n? And I also can't change/edit the layout of "/i18n/en". It is just stated

This page cannot be updated manually. This page is a translation of the page Template:Global maintenance category/i18n and the translation can be updated using the translation tool.

Thx a lot already and best Regards!

W like wiki (talkcontribs)

Actually now it works, maybe a Cache problem!? But still strange for me, that I was not able to edit /i18n/en, but I am also not so experianced in i18n affairs, hmmm.

Nikerabbit (talkcontribs)
W like wiki (talkcontribs)

Thank you Nikerabbit! But this link is too general and says nothing about what is i18n. My focus is less in translating instead more in layout matters: How to change the layout of a tranlated page/template with these subpages.

  • Sometimes there is an /i18n/layout subpage, which is editable, here not
  • Here is an /i18n page what is editable
  • The subpage /i18n/en offers "edit" too on the tabs and it is possible to see the code, but then a message box as mentioned above appears.
  • For an other subpage like /i18n/de it offers only "tranlate" and no code is visible.

Do you understand or someone else has an answer or knows a more specific help page for that? So what the hell is i18n? :) Even on c:Commons:Localization nothing. Thx already!

Nikerabbit (talkcontribs)

Language code subpages of translatable pages (like /en, /de, etc.) are not directly editable and they are managed by the Translate extension.

W like wiki (talkcontribs)

Ok nikerabbit, that seems to be right for /i18n/en etc. but simple /en subpages (e.g. C:Template:Template category/en) are editable. Thats why I asking for this nowhere-explained-i18n-subpage-structure what seems to make a kind of difference!? Regards

Nikerabbit (talkcontribs)

Those aren't part of translatable pages. You can usually identify translatable pages by the "Other languages:" section at the top with blue circles.

Reply to "Maybe also a Cache Issue (or /i18n issue)?"

Re:Two primary languages on a wiki?

Summary by PKFP

I found in Manual:$wgPageLanguageUseDB that we forgot the second line:

$wgPageLanguageUseDB = true;

$wgGroupPermissions['sysop']['pagelang'] = true;

PKFP (talkcontribs)

I just saw in this topic below (https://www.mediawiki.org/wiki/Topic:Xlczwiqmyio6ymei) that it's possible to set different content languages for source pages,but I think I need further instructions.
So I have to add $wgPageLanguageUseDB = true; to LocalSettings.php, but how then do I mark the content language of a page?

And does that mean anyone can create a page in any language on my wiki? Is that a good idea, or are there downsides? We have 10 active languages and I guess the ability to create a page in a different language than English would encourage more people to create content.
The downside I see: If e.g. the page is created in Japanese than every translator needs to know Japanese to translate the page in any language, or can they still translate from the English translation somehow? Also information will have to be added in the Japanese version of the page first then, right? Or can I e.g. switch the content language without losing the text in any language?

Nikerabbit (talkcontribs)

There is a link in the sidebar to page information where you can find link to change the language. You can also go to Special:PageLanguage directly.

The correct language must be set before page is marked for translation and cannot be changed later.

There is currently no first class support for translating through a middle language, but translators can emulate that by ensuring that English appears in their assistant languages.

PKFP (talkcontribs)

Hey, thank you, but somehow this doesn't work yet. We've added $wgPageLanguageUseDB = true; to LocalSettings.php but nothing happened. I can't access Special:PageLanguage or find the link in the page information page. Is there something else we need to configure first?

Nikerabbit (talkcontribs)

That is a MediaWiki core feature, so I am not familiar with debugging that. What version of MediaWiki are you using?

Automatically Clear Page Cache

Derf Jagged (talkcontribs)

Is there a way that you could add functionality for it to run a page cache purge (?action=purge) after saving a translation? I ran into issues on a private wiki where the list of available languages for a page wouldn't update when adding a new language until the page cache was purged.

Nikerabbit (talkcontribs)

This should work correctly out of the box. Is your job queue configured correctly?

Derf Jagged (talkcontribs)

Jobs run and the queue is currently empty when I try and run runJobs.php. Is there something special that needs to be setup for Translate?

Tacsipacsi (talkcontribs)
Nikerabbit (talkcontribs)

There is a purge call in \MediaWiki\Extension\Translate\PageTranslation\Hooks::updateTranslationPage

Reply to "Automatically Clear Page Cache"

Translation in the source language, English!

Summary last edited by Clump 12:43, 18 February 2024 3 months ago

Manual:$wgPageLanguageUseDB can be used to change page source language.

Donxello (talkcontribs)

Hi, we have an English Wiki but a German article to be translated. By default the extension marks the article as English and consequently we get

Translations to this language in this group have been disabled. Reason:

English is the source language of this page.

Any ideas how to mark this article as German and how to allow translations in the source language?



Nikerabbit (talkcontribs)

Hopefully you have recent enough MediaWiki to enable Manual:$wgPageLanguageUseDB in LocalSettings.php. Then you can use this feature to change the page content language to German. But you should do that before marking the page for translation.

Setting default priority languages

Derf Jagged (talkcontribs)

I have a wiki that I'd like to gather a couple groups of people to translate to Spanish and Japanese specifically. Is there a setting in the config I can use to limit it so the only available languages to translate to are Japanese and Spanish?

Essentially, I am looking for a way to enforce "Prevent translations to languages other than the priority languages" at a site-wide level or at least make it the default option for when you mark a page for translation.

Nikerabbit (talkcontribs)

Putting this in your LocalSettings.php may work (haven't tested):

$wgHooks['TranslateSupportedLanguages'][] = static function( &$list ) {
    $list = array_intersect_key( $list, [ 'es' => true, 'ja' => true ] );
Derf Jagged (talkcontribs)

That worked! Though I also added 'en' to the list, otherwise it has a little warning about 'en' not being a valid language (though it will do this for anyone who has their language set to something not in the list).

It does still show "Message Documentation" which would be nice to hide (tried 'qqq' => false, no luck). But this still miles better for my purposes.

Thank you!!!

Nikerabbit (talkcontribs)

You should be able to set $wgTranslateDocumentationLanguageCode = false; in your LocalSettings.php to completely disable message documentation.

Derf Jagged (talkcontribs)

Ah, I didn't understand the purpose of that from the config page. Makes sense now, thank you!

Reply to "Setting default priority languages"

Is it possible to leave out or add parts in a translation?

PKFP (talkcontribs)

There are sometimes parts in an English source text, that are not relevant to any other language. How can I mark a passage of text so it won't be translated (but also not just display in English within the translated page)?

Also sometimes e.g. on our page about the rules for translating, I'd like to encourage translators to add text that isn't there in English. To stick with the example this would be used to describe how to use gender-inclusive language in languages other than English, where it's mostly not necessary. E.g. in German our translators should translate "users" to "Nutzer*innen" and "someone" to "jemensch".
Is that possible? Ideally so that translators are told what should be added there (if relevant for that language)? I guess I could just do it with a comment, like: <translate><!--Please describe the situation in your language here--></translate>.

Reply to "Is it possible to leave out or add parts in a translation?"

Nothing happens after preparing page for translation

Summary by Jdforrester (WMF)

This bug is caused by the Cargo extension being installed.

Saucy (talkcontribs)

So, I have an existing page on my wiki. I've placed all the content within <translate> tags, and I have a <languages /> tag at the top. But absolutely nothing changes about the page after I make this edit. There is no languages bar anywhere and there is no way to mark the page for translation. There's nothing in MediaWiki's job queue holding it up, and I followed the instructions when installing and configuring the language extension bundle. I am sometimes able to get it to work on certain pages, but on other pages nothing happens at all. How do I get the extension to work consistently?

Nikerabbit (talkcontribs)

Unfortunately I have no idea since I have not seen such behavior. You could try the tips from Manual:How to debug to see if there are any errors or warnings that could give clues.

Have you tried visiting Special:PageTranslation directly?

Saucy (talkcontribs)

Special:PageTranslation did not list the page at all.

After digging through the debug logs, I eventually figured out that it was being caused by an unrelated extension (Cargo) throwing a missing database table exception during the saving of the page, which somehow prevented Translate from doing its thing. After recreating the Cargo tables, I was able to get Translate working again.

Wasn't easy to troubleshoot this as the wiki interface never indicated an exception.

Reply to "Nothing happens after preparing page for translation"
Nippo4512 (talkcontribs)

I have a wiki for a community that is pretty much split in half between two languages, that being English and Japanese. Unfortunately, our community pretty much does not have a primary language between these two. With this extension, our wiki is currently able to translate English content into Japanese, but I would like to have the ability to do JP -> EN, as well as for the Japanese writers to have the ability to write new content on pages that have already been translated. This extension is very good for organizing translations, at the consequence of flexibility on Japanese pages, as they cannot be edited normally. Is it possible to lift this restriction, or is there another possible extension or method to achieve this? It feels very limiting to not allow our Japanese half of the community to contribute new material, and are instead only limited to English translation.

I was able to find this link: Multilingual MediaWiki#"Create a page in this language", which allows for pairing pages of different languages. This method may suffice if it is not possible to add more flexibility to the extension. However, this may lead to translation being more cumbersome.

Nikerabbit (talkcontribs)

You can (and should) set the page content language for each page. To do that you need to set $wgPageLanguageUseDB = true;. Translate extension will then use that as the source language.

It is not possible to new add content to pages in languages other than the source language. with this extension. ContentTranslation extension could in theory be used, but it's not officially supported outside Wikipedia, and it doesn't track translations like Translate does.

Nippo4512 (talkcontribs)

Thanks for your answer!