Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Creating machine services translation View modes: 
User avatar
Member
Member
rafik - 12/7/2013 2:18:49 PM
   
Creating machine services translation
Hi guys,

I followed developer guide (http://devnet.kentico.com/docs/devguide/index.html) about Creating custom machine services for translation.

I create the SampleMachineTS.cs in App_Code and I add exact data as in example for testing to see if it's work before adding an custom data. Then I add in Site Manager -> Development -> Translation services new translation service.
In Service provider assembly name, I add (App_Code)
And in Service provider class name, I add (SampleMachineTS)
And I checked Is machine translation service and Service is enabled.
I get message when I save "This service is not available on current site, please check service settings in Site Manager -> Settings -> Content -> Translation services"

Well I can't checked because its custom data.
So I add also ClassLoader.cs and in scheduled tasks. But no success.

I am not able to see the custom machine service when translate from original language to the target language.

Is there any extra information I need to know for this custom machine service to work?

My best regards
Rafik

User avatar
Member
Member
rafik - 12/8/2013 1:14:24 PM
   
RE:Creating machine services translation
I found my problem, the ClassLoader.cs wasn't done proprely that's why I wasn't able to see the custom machine services.

Now I need to understand two points about the customs codes in the tutorial.

the first points is in code of the methods Detect it's showing
return "en-US";

but how we can make it default detect because the source language can be germany or italian, etc...

The second points is when you translate from a language, from what I understand the system take all strings to be translated and put it in a XLIFF format. So in translate method, text parameter is what exactly in XLIFF format. Like I saw in the follow example:
<xliff version="1.2">

<file original="cms.document;25" source-language="en-US" target-language="fr-FR" datatype="htmlbody">

<body>
...

<trans-unit id="newstitle">

<source><![CDATA[Apple iPad Mini In Stock]]></source>

</trans-unit>

<trans-unit id="newssummary">

<source><![CDATA[Today, we have good news for all fans of the awesome Apple iPad. We are glad to announce that its new version, Apple iPad Mini, is available in our web shop. Furthermore, we keep our reasonable pricing policy, providing the lowest price currently available on the Web.]]></source>

</trans-unit>
...

</body>

</file>

</xliff>

It saying inside <trans-unit>, but is it the whole code or just inside the source?

Maybe it's an easy question but I still don't get those two parts.

My best regards
Rafik

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/12/2014 6:43:32 AM
   
RE:Creating machine services translation
Hello Rafik.

Regarding your points:

1) Detect method
Our Dev guide contains just a sample code demonstrating basic functionality. If you want to have custom machine translation, you need to write custom code which reads proper culture version from original text. For example, BingTranslatorService uses:

string requestString = "http://api.microsofttranslator.com/V2/Http.svc/Detect?Text=" + HttpUtility.UrlEncode(text);
return ContactService(clientId, clientSecret, requestString);


So, you need to query your external service and get proper culture version.

2) Machine services do not use XLIFF files. The “textToTranslate” contains direct text inserted e.g. in your TextBox control (Editable text web part). Maybe our documentation is a little bit unclear about it, but XLIFF files are being used for human translations only.

Best Regards,
Radek Macalik