Topic on Extension talk:Translate

Machine translation help

12
Protnet (talkcontribs)

I have just installed translate (latest snapshot in MW 1.20.02) and it works fine but I cannot activate machine translation. I got an API key from Apertium and another one form Microsoft (domain verified too). I have put this in LocalSettings.php:

include_once("$IP/extensions/Translate/Translate.php");
$wgGroupPermissions['translator']['translate'] = true;
$wgGroupPermissions['sysop']['translate'] = true;
$wgTranslateDocumentationLanguageCode = false;
 
# Add these too if you want to enable page translation
$wgGroupPermissions['sysop']['pagetranslation'] = true;
$wgEnablePageTranslation = true;
 
$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',
        'key' => null,
        'timeout' => 3,
        'type' => 'microsoft',
);
$wgTranslateTranslationServices['Apertium'] = array(
        'url' => 'http://api.apertium.org/json/translate',
        'pairs' => 'http://api.apertium.org/json/listPairs',
        'key' => null,
        'timeout' => 3,
        'type' => 'apertium',
        'codemap' => array( 'no' => 'nb' ),
);
$wgTranslateTranslationServices['translatewiki'] = array(
        'url' => 'http://translatewiki.net/w/api.php',
        'viewurl' => 'http://translatewiki.net/wiki/',
        'displayname' => 'translatewiki.net',
        'cutoff' => 0.75,
        'timeout-sync' => 4,
        'timeout-async' => 4,
        'type' => 'ttmserver',
        'class' => 'RemoteTTMServer',
);

# Private api keys for machine translation services
$wgTranslateTranslationServices['Apertium']['key'] = 'XXXXXXXXXXXXXXXX';
$wgTranslateTranslationServices['Microsoft']['key'] = 'XXXXXXXXXXXXXXXXXXXXXX';

1. The only thing that seems to work is TTMServer. I got a couple of suggestions alright. But not Apertium or Microsoft. What is wrong?

2. I also don't know if the "translatewiki" service section is properly set up or if it's even about this at all. The way I understand it by the documentation, I thought I could get suggestions from translatewiki.net's database. Is it like this and if it is what is the proper syntax?

3. In the extension's homepage it is mentioned that it also works with Google translation service. How can I implement Google too?

Nikerabbit (talkcontribs)

Wrt 1), what is the source language of your messages? Most of the services only support certain language pairs.

Wrt 3), if you see Google mentioned, it is outdated information. We used to support Google api v1, but since v2 it is non-free service, so we haven't added support for it.

Protnet (talkcontribs)

Source language is Greek (el), target is English. I know (from translatewiki.net) that the reverse pair (English to Greek) is supported, at least by Microsoft.

Nemo bis (talkcontribs)

Microsoft has changed its authorisation scheme, are you sure there's nothing wrong in that regard? Is Yandex an option for your language?

Protnet (talkcontribs)

I spent hours of reading Microsoft documentation and experimenting but with no luck.

Microsoft did change their authorisation model and there is also a quota now limiting the free translations to 2,000,000 characters per month. The registration process is described in MSDN library and full steps in MSDN blog. The idea is that, first you subscribe to the Microsoft Translator API on Azure Marketplace and then you register your wiki with it. Then you get a Client ID and a Client secret which, according to documentation, are both needed to access the service. But in LocalSettings.php there is only one 'key' variable ($wgTranslateTranslationServices['Microsoft']['key'] = '*******';)

I also looked in translatewiki.net's configuration to see if there is any customization of some sort (because as I said before, Microsoft Translator seems to work fine there for my (reverse) language pair: English to Greek) but PrivateSettings.php shows the same. Can anyone from translatewiki.net please inform me if they did something special there, or, how they did it? What exactly do they use for 'key'??? And how exactly did they obtain it?

Nemo bis (talkcontribs)

I think it was so much time ago that they don't remember, see bugzilla:41435. Perhaps the old keys have been kept functioning? I couldn't make sense of the new plans and the throttles applied to TWN, when I tried. Too bad for Yandex and Greek.

Protnet (talkcontribs)

Oh yes. Silly me. I just remembered reading somewhere about it. Old keys (Bing API keys) still work. So I guess no machine translation for Greek for now. How about my 2nd question then? Is it possible to use TWN's translation memory via their API?

Nemo bis (talkcontribs)
Protnet (talkcontribs)

Thanks! I just filed a bug!

And I found the answer about translation memories. It is actually pretty simple but I had to read everything first to figure it out. My wiki is in Greek so translations go from Greek to English. But in TWN all existing translations are from English to Greek, i.e. translation memory consists only of Greek (and other language) phrases but no English at all! So when I changed my wiki's default language to English and tried to translate some English to Greek I got dozens of suggestions from TWN's memory!

So the working cofiguration for remote access to TWN' memory is:

$wgTranslateTranslationServices['translatewiki'] = array(
        'url' => 'http://translatewiki.net/w/api.php',
        'viewurl' => 'http://translatewiki.net/wiki/',
        'displayname' => 'translatewiki.net',
        'cutoff' => 0.75,
        'timeout-sync' => 4,
        'timeout-async' => 4,
        'type' => 'ttmserver',
        'class' => 'RemoteTTMServer',
);

Should I copy it somewhere in Help:Extension:Translate/Translation memories#Configuration?

PS. Apertium still not working. I tried English to Spanish (supported).

Nemo bis (talkcontribs)

Please copy it to the talk of that page. Any other suggestion on what was unclear/missing in it will be acted upon by someone (probably not me because I know so little, almost nothing ;) ).

Nikerabbit (talkcontribs)

I have not been advertising the translatewiki.net translation memory because I can't promise that it will be able to hand all the traffic.

Once we can get the Solr-backed translation memory running, we will recheck the situation.

Protnet (talkcontribs)

Yandex does not support Greek.

Reply to "Machine translation help"