Extension talk:Translate

Jump to: navigation, search

About this board

Edit description

Archive.


By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL
67.244.49.134 (talkcontribs)

(Moved from support desk and modified) I have translate installed on my wiki, but when I try to add a translation for a page I get the following error. Saving the translation failed: Unknown error: "tpt-unknown-page" FuzzyBot also isn't running when I mark a page for translation. Running runJobs.php did nothing. Running showJobs.php gave the result 0. Any help would be great. Thanks.

Tuxxic (talkcontribs)

Hi,

Did you run runJobs.php from your actual PHP CLI instead of using an extension like MaintenanceShell ?

I had the same problem but running from CLI solved it.

In fact, in my case I'd like to runJobs eachtime I mark a page for translation, since it isn't done automatically ... :)

This comment was hidden by 24.39.1.139 (history)
24.39.1.139 (talkcontribs)

I ran it using SSH.

2002:43F4:3186:1234:35AE:218:4B7:62E5 (talkcontribs)

Please help me.

Nikerabbit (talkcontribs)

So if runJobs.php doesn't work, does running extensions/Translate/scripts/createMessageIndex.php work?

24.39.1.139 (talkcontribs)

That worked

24.39.1.139 (talkcontribs)

FuzzyBot still isn't creating the /en subpages though.

Nikerabbit (talkcontribs)

I don't have much info, so my best guess is that either the JobQueue is seriously broken and not running jobs, or there is some kind of error that prevents Translate from adding jobs to the queue. Enabling PHP error reporting as well as logging exceptions could help to identify the cause. For example:

error_reporting( E_ALL | E_STRICT );

$wgShowExceptionDetails = true;

$wgDebugLogGroups['exception'] = ini_get( 'error_log' ); 

$wgDebugLogGroups['error'] = ini_get( 'error_log' );

$wgDebugLogGroups['fatal'] = ini_get( 'error_log' );

Tuxxic (talkcontribs)

Edit : So here is what I get in my PHP error log after :

  • Adding a new chunk of text
  • Marking therefore the page for translation
  • then trying to translate it afterwards

I don't experience the problem if I update an already existing message group, if it can help you.

Thanks for advice on error logs :)

2017-05-03 12:01:19 SERVERNAME database-name: [3f588d59648bf5725b6fb31e] /index.php?title=Sp%C3%A9cial:PageTranslation   DBUnexpectedError from line 2866 of C:\mediawiki-path\includes\libs\rdbms\database\Database.php: MWCallableUpdate::doUpdate: Cannot flush snapshot because writes are pending (JobQueueDB::doBatchPush).

#0 C:\mediawiki-path\includes\libs\rdbms\loadbalancer\LoadBalancer.php(1092): Database->flushSnapshot(string)

#1 [internal function]: LoadBalancer->{closure}(DatabaseMysqli)

#2 C:\mediawiki-path\includes\libs\rdbms\loadbalancer\LoadBalancer.php(1390): call_user_func_array(Closure, array)

#3 C:\mediawiki-path\includes\libs\rdbms\loadbalancer\LoadBalancer.php(1100): LoadBalancer->forEachOpenMasterConnection(Closure)

#4 [internal function]: LoadBalancer->beginMasterChanges(string)

#5 C:\mediawiki-path\includes\libs\rdbms\lbfactory\LBFactory.php(176): call_user_func_array(array, array)

#6 [internal function]: LBFactory->{closure}(LoadBalancer, string, array)

#7 C:\mediawiki-path\includes\libs\rdbms\lbfactory\LBFactorySimple.php(134): call_user_func_array(Closure, array)

#8 C:\mediawiki-path\includes\libs\rdbms\lbfactory\LBFactory.php(179): LBFactorySimple->forEachLB(Closure, array)

#9 C:\mediawiki-path\includes\libs\rdbms\lbfactory\LBFactory.php(200): LBFactory->forEachLBCallMethod(string, array)

#10 C:\mediawiki-path\includes\deferred\DeferredUpdates.php(262): LBFactory->beginMasterChanges(string)

#11 C:\mediawiki-path\includes\deferred\DeferredUpdates.php(225): DeferredUpdates::runUpdate(MWCallableUpdate, LBFactorySimple, integer)

#12 C:\mediawiki-path\includes\deferred\DeferredUpdates.php(133): DeferredUpdates::execute(array, string, integer)

#13 C:\mediawiki-path\includes\MediaWiki.php(891): DeferredUpdates::doUpdates(string)

#14 C:\mediawiki-path\includes\MediaWiki.php(720): MediaWiki->restInPeace(string)

#15 C:\mediawiki-path\includes\MediaWiki.php(739): MediaWiki->{closure}()

#16 C:\mediawiki-path\includes\MediaWiki.php(543): MediaWiki->doPostOutputShutdown(string)

#17 C:\mediawiki-path\index.php(43): MediaWiki->run()

#18 {main}

Nikerabbit (talkcontribs)

Interesting. There are some related reports for this error message: https://phabricator.wikimedia.org/search/query/dmAqtYvLSuam/ I'll test this myself to see if I can reproduce. Which version of MediaWiki are you running?

Tuxxic (talkcontribs)

In my case, 1.28.2, but I experienced it also on 1.28.0.

113.172.20.5 (talkcontribs)

Hi Nikerabbit,

I got same problem Saving the translation failed: Unknown error: "tpt-unknown-page"

Wiki version 1.28.1

Use extensions/Translate/scripts/createMessageIndex.php is OK, but translate new page doesn't work

Nikerabbit (talkcontribs)

I don't know if this is specific to 1.28, but I just tried with MediaWiki vagrant on a clean install, using default MLEB configuration, and I did not have this problem.

Tuxxic (talkcontribs)

Thanks for testing.

Would you be interested in the list of my extensions installed, in order to see which one might be the culprit then ?

Nikerabbit (talkcontribs)

There is some info at https://phabricator.wikimedia.org/T100085 about different but possible related error message. It says it would be about exceptions.

I also can reproduce "Cannot flush snapshot" errors on my wiki now, so let's see if I can debug further.

171.233.234.227 (talkcontribs)

Thanks for debug Nikerabbit

Reply to "Translate"

Conflict with Extension:LDAP_Authentication

1
217.6.145.253 (talkcontribs)

Topic:Tfu65b5pncef5p6s

Reply to "Conflict with Extension:LDAP_Authentication"

Cannot mark for translation

3
Summary by Nikerabbit

A conflict between ConfirmEdit and Translate.

217.6.145.253 (talkcontribs)

When i click the link 'Diese Seite zur Übersetzung freigeben' (Wiki language is german) I get redirected to

index.php?title=Spezial:Übersetzung_von_Seiten&target=TargetPage&do=mark.

But the special page does not exist! What could i do?

Nikerabbit (talkcontribs)

It sounds some kind of configuration error to me. I have not seen such an issue before.

217.6.145.253 (talkcontribs)

It seems it was a conflict between Extension:ConfirmEdit and Translate. Since we didn't really need that one we just removed it.

Are there Active steps planned for the internationalization of category names?

2
Atef81 (talkcontribs)

I am starting a multilingual environment that will have mainly 4 languages. The problem is that the language that will have the most content is Arabic, and my aim is to get as much content translated to the other languages.

When I tried the Translate extension, it worked, but having the categories names in Arabic then "/en" and "/fr" is not practical as non Arabic speakers will find it impossible to understand.

I checked several forums and read that there are steps in the pipeline to rectify this. However, I can't find enough information about this on the Extension official page.

I am trying to start from a page like this and reach an end result like this, where page title and category names are translated to the article language.

Is this likely to be an option soon, or I need to setup a family of wikis that share the same resources like this Mediawiki manual?

@Nikerabbit

Nikerabbit (talkcontribs)

Thanks for asking!

Due to possible naming conflicts, it's not a good idea to translate the actual page titles, unless you disambiguate them with a language code anyway.

But what you can do is to use the feature to translate the (category) page title. This does not affect the URL of the page, nor any links to that page. However, there are feature requests for MediaWiki core to use this translated title in links, including the category list at the bottom of the pages. It is not clear, though, when these will happen. I believe the features are not controversial, but some performance concerns must be taken into account while implementing them.

Some links:

Reply to "Are there Active steps planned for the internationalization of category names?"
87.163.174.140 (talkcontribs)

I have "page a" and "page b" in the same namespace:

page a:

<translate>
blind text
</translate>

{{page b}}

<translate>
another blind text
</translate>

page b:

<translate>
third blind text
</translate>

the first translate markup from page b rest to be displayed in page a

how can I avoid this

page a: https://www.jurtenland.de/wiki/Jurte

page b: https://www.jurtenland.de/wiki/Wie_baue_ich_eine_Jurte_auf%3F

Thank you very much for your help

Nikerabbit (talkcontribs)

See Templates section in Help:Extension:Translate/Page translation administration/fi#Markup examples.

For now, basically you need to include a subpage of the template, which does not contain the translate tags.

Reply to "Translate Pages with Templates"
Juandev (talkcontribs)

Hi guys, I wanted to point some Commons guys on user manual, how to tag their page by translate tag, but I perfofmed several clicks and didnt find it yet. So this is not a question, where it is (I will ask on IRC), this is a point its not easy to find it. I started at commons:translate... where i would expect it, but its not there, so finally I ended up here, but even here I cannot find fastly user guide.

Tuxxic (talkcontribs)

Hello @Juandev, I got help by browsing this page, when I started using the extension : Help:Extension:Translate/Page translation example

Hope it will be helpful for you too !

Reply to "Not easy to find user manual"
JamesPoulson (talkcontribs)

Not an issue as such but how can links to other languages from a page in English be shown? Perhaps this can be done through a template?

Also, it is possible to automatically redirect to another language if the Wiki language is changed?

Thanks in advance for any suggestions.

Nikerabbit (talkcontribs)

I am not sure what exactly you are asking, but please check out Special:MyLanguage links and and $wgTranslatePageTranslationULS.

JamesPoulson (talkcontribs)

Hi Nikerabbit,

$wgTranslatePageTranslationULS appears to be what I'm looking for with respect to Universal Language Selector. Will give it a go.

I also found out that Extension:Translate adds a <languages /> tag which might be documented somewhere. This is also what I was looking for and it has the added advantage of inviting people to make a translation to another language when one hasn't already been done. It'd be great if the appearance of the languages box can be customised.

I was looking at MediaWiki:Sitenotice but that seems suited to other purposes.

JamesPoulson (talkcontribs)

$wgTranslatePageTranslationULS works great :) . Going to explore the options further to see about translation services.

Reply to "Links on page to translations"
JamesPoulson (talkcontribs)

Maybe I missed something during the installation.

This line:

include_once "$IP/extensions/Translate/Translate.php";

Leads to an exception saying that table revtag doesn't exist.

Any suggestions as to fix this? Does update.php or something need to be run?

Tuxxic (talkcontribs)

Hi, Have you tried to actually run update.php ? If a table doesn't exist, it will create it, most of the times.

JamesPoulson (talkcontribs)

Yes.

I don't have command-line access but did it through the browser.

The table was created and now it works fine.

Does $wgPageLanguageUseDB has any effect? (page language different from $wgLanguageCode)

5
Summary last edited by Andreas Plank 20:43, 11 November 2016 6 months ago

$wgPageLanguageUseDB does not work as expected in 1.26.

Fixed in 1.27, related to https://phabricator.wikimedia.org/T136545

Andreas Plank (talkcontribs)

I use extension:Translate 2016.01 and MediaWiki 1.26.2 and set $wgPageLanguageUseDB=true;. My wiki is in German ($wgLanguageCode=de;) and I saved a page in Russian, then I changed page language via special page of page information to Russian and so far everything appears OK. But after processing the page into the translation system the translation system regards the page still as being German an not Russian although page information reports the page to be Russian. Somewhere seems a bug to me.

Does extension:translate takes into account a different page language (when enabled via $wgPageLanguageUseDB)? Or has it any effect to the translation system? I perceive no effect whatsoever except that the page info lists it as a different language.

What can I do to force the translation system to take the page language into account?

Nikerabbit (talkcontribs)

I have vague memory that Title::getPageLanguage had a bug that is fixed in master. I'll try to test this later and update with details. Possible workaround is to use the PageContentLanguage hook.

Mboisson (talkcontribs)

Any news on this ? I'm looking to make a wiki in which source language of pages can vary. I can't figure out how to use the PageContentLanguage hook, and wgPageLanguageUseDB does not seem to work as it should... 

Do we know if it is fixed in 1.27 ?

Andreas Plank (talkcontribs)

Yes it is fixed with 1.27, but I can't remember where and when I confirmed this. I thought I had a Github- or phabricator-Bug-discussion with Nikerabbit, but I can't find it. Nevertheless I use MW 1.27.1 and it works now: switch the page language first (at link page information) and then the translation works as expected for that particular page language to be the original language.

Mboisson (talkcontribs)

Thank you. I have tested it on our development server (which runs 1.27.1). I guess we now have a reason to upgrade from 1.26 to 1.27.1.

Microsoft Translate API v2 don't work with Translate extension

18
Tuxxic (talkcontribs)

Hi,

I wish to use Microsoft Translator API for translation suggestions. Unfortunately, I can't seem to use it.

The source code to extensions\Translate\webservices\MicrosoftWebService.php says it should work, but it doesn't.

- New Microsoft API needs 2 information to request a token : clientID and clientSecret, then you get an Access Token.

Those are not implemented in the current MicrosoftWebService.php and therefore I can't use it ...

There are a few help topics (and PHP examples) on https://msdn.microsoft.com/en-us/library/hh454950.aspx#phpexample - my skill in PHP are very shallow, and I can't figure out how to convert the PHP samples to MediaWiki code.

Can someone either help me doing it, or give me the name of a machine translation service that works out of the box ?

Jdforrester (WMF) (talkcontribs)

This was filed as https://phabricator.wikimedia.org/T46679 in February 2013, but unfortunately it doesn't look like there's been progress.

Tuxxic (talkcontribs)

Hi,

Thanks for the link !

I got the patch set 7 from https://gerrit.wikimedia.org/r/243427 and manage to make it work flawlessly, I don't know why this was reverted ?

I just had to modify file MicrosoftWebService.php and add in the getMSTokens function the following line :

$options['sslVerifyCert'] = false;

LocalSettings.php does works by using the following :

$wgTranslateTranslationServices['Microsoft'] = array(
     'url' => 'http://api.microsofttranslator.com/V2/Http.svc/Translate',
     'timeout' => 3,
     'clientId' => "your_client_id",
     'clientSecret' => "your_client_secret",
     'type' => 'microsoft',
);

@Nikerabbit maybe can you give a look at the functions and update them ? I am sorry I don't know how to use the patch system :(

I could update the docs if you need, though.

Nikerabbit (talkcontribs)

I am curious why ssl check needs to be disabled? That is very bad for security.

The patch is not reverted, it is just stuck on review queue waiting for some improvements.

Tuxxic (talkcontribs)

Oh sorry.

In fact, I used this policy because I saw a SSL warning , and wanted to test.

I checked using this page : https://msdn.microsoft.com/en-us/library/hh454950.aspx#phpexample

There is a parameter in the test script :

//CURLOPT_SSL_VERIFYPEER- Set FALSE to stop cURL from verifying the peer's certificate.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

You can set it to true, but I don't know (yet) how to configure SSL for this, so here I go.

Tuxxic (talkcontribs)

Hello, I found why I didn't manage to get this to work : in fact, it was my PHP configuration which was not set up correctly.

Here's how to configure SSL verification in cURL PHP extension.

I found this website : https://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/

Which made me think that I never configured anything in cURL in my PHP installation. So I went to this page : https://curl.haxx.se/docs/caextract.html, downloaded the cacert.pem, and then configured it in my php.ini : curl.cainfo=c:\php\cacert.pem

Et voilà !

Tuxxic (talkcontribs)

Hi,

I managed to make it work with the patch set 7, but there is something I don't know how to figure out, if someone can help :

I have to modify then save everyday the LocalSettings.php file in order to have the Microsoft Web Service to connect and give suggestions : even if I don't modify anything in the file, it is mandatory to have the suggestions.

What can be wrong ? Is there a file caching of LocalSettings.php ?

Nikerabbit (talkcontribs)

Could you describe what are the symptoms of the failure if you do not save LocalSettings.php every day?

Tuxxic (talkcontribs)

Yes, the translation aid windows looks like this : http://imgur.com/a/fg5Cr

To the right, I don't have any suggestions.

When I touch the file, I have "Loading ..." then Suggestions and I begin to translate.

Nikerabbit (talkcontribs)

That is actually https://phabricator.wikimedia.org/T111685 and should be fixed already in MLEB 2016.04. Which verison are you using?

Tuxxic (talkcontribs)

Yes ! It works. I was using the previous version, and didn't update. I'm not still familiar with how to update MediaWiki modules all at once.

Thanks a lot for your help.

Nikerabbit (talkcontribs)

My plan is to review the open patch during this quarter.

Tuxxic (talkcontribs)

@Nikerabbit, just to notify you, I can't use Microsoft + TTMServer along.

My configuration is the following :

$wgTranslateTranslationServices = array();

$wgTranslateTranslationServices['TTMServer'] = array(
     'database' => false, // Passed to wfGetDB
     'cutoff' => 0.75,
     'type' => 'ttmserver',
     'public' => false,
);

$wgTranslateTranslationServices['Microsoft'] = array(
     'url' => 'http://api.microsofttranslator.com/V2/Http.svc/Translate',
     'clientId' => "myclientid",
     'clientSecret' => "mysecret",
     'type' => 'microsoft',
);

I only used the patch files to use MS v2 translate API, but in order to have the service to work, I have to disable TTMServer.

Not a very big problem per se, since I used it only a few times, but in case, I can investigate with you if you need.

Nikerabbit (talkcontribs)

I am not sure what could be the problem with TTMServer. Perhaps you could open a new discussion thread with some more details?

Tuxxic (talkcontribs)

Hi @Nikerabbit - I couldn't reproduce. It might be a misconfiguration from me, because I just updated MW to 1.27 - sorry for inconvenience !

Tuxxic (talkcontribs)

Hi, I downloaded MLEB 2016.08 and the patch still is not present. Can we hope for it to be in the next MLEB ?

Nikerabbit (talkcontribs)

It will be present in MLEB 2016.10 coming soon.

Reply to "Microsoft Translate API v2 don't work with Translate extension"