Extension talk:Translate

About this board

Archive.


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

7
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?

4
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

5
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!

2
Summary last edited by Clump 12:43, 18 February 2024 1 month 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?

Thanks

Tristan

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

5
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?

1
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

3
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!

Accessing to the translated name page by PHP

2
Marcellinjobard (talkcontribs)

I want to display the translated page name in other page.

If I understand translated title is not in page content but available by API with api.php?action=parse&page=Page_Title/fr&prop=displaytitle

But I'll use a hack of DPL3 to find the translated name of a page with PHP. Skins has access to it thanks to Skin.php with `$out->getPageTitle();` but I don't think that extensions like DPL have access to the "output".

So can I access the translated title from another extension?

APatro (WMF) (talkcontribs)

Hello,


One way you could do this in another extension involves using the \MediaWiki\Extension\Translate\PageTranslation\TranslatablePage class in the Translate extension:

use MediaWiki\Extension\Translate\PageTranslation\TranslatablePage;
// Main Page Translate is the title of the translatable page
$tp = TranslatablePage::newFromTitle( \Title::newFromText( 'Main Page Translate' ) );
// fr is the French language code
$tp->getPageDisplayTitle( 'fr' );

Regards,

Abijeet Patro

Reply to "Accessing to the translated name page by PHP"

Accessing a page by its localized name

2
5.165.137.186 (talkcontribs)

I have a page /site/index.php?title=Example

I translated its contents into German including the title.

I can access the localized page via /site/index.php?title=Example/de but not /site/index.php?title=Beispiel

Is there any way to do this?

Tacsipacsi (talkcontribs)

No, because nothing prevents you from translating two titles in the same way, which would cause a conflict. See also phab:T301052.

Reply to "Accessing a page by its localized name"