Skip to content

olamy/translate-puzzle

Repository files navigation

To get the sources : git clone git://github.com/olamy/translate-puzzle.git

Pre Requisites :
  * Apache Maven 3.0.2 see http://maven.apache.org
  * JDK 1.6 (with a JAVA_HOME pointing to the extracted jdk)
  
use simply : mvn tomcat:run
and use a browser : http://localhost:8080/
Edit Mode is activated with request parameter : http://localhost:8080/?edit=true
All html element with the class systran_seg will be available for translation :
<span class="systran_seg" id="Sp14_s2_o"></span>
The source text must be in a element :
<span class="systran_seg_src" id="Sp14_s2_o_src" style="display: none"></span>

NOTE the syntax with _src happened at the end of both class and id.
At the loading time, all element with the systran_seg will "scanned" to search the corresponding element with id _src. 
If the translation exists it will be replaced with the translation
if the translation doesn't exist the source text will be used.
As it's a POC source text use harcoded language en and target hardcoded fr. 

In the edit mode, a mouseover handler will activate translation of an element and filled some values so the user will be able to add/update a translation and to send it to the backend.
The ui communicates with the server through json REST request.

NOTE : the current implementation saves translation only memory.

Services are defined in the class DefaultTranslationService and exposed in REST tru standard annotations defined in JSR 311 with the jersey implementation.

The translate search service is available at the following path : http://localhost:8080/rest/TranslationService/translate 

This service accept both json and xml content type as request and response.
Request Json Format :
{"sourceText":"Beer","sourceLanguage":"en","targetLanguage":"fr","targetText":null}
Response Json Format :
{"sourceLanguage":"en","sourceText":"Beer","targetLanguage":"fr","targetText":"bière"}
return no value if the translation doesn't exists.

NOTE the service is also available with xml request/response.

The translation save service is available at the following path : http://localhost:8080/rest/TranslationService/reccordTranslation
{"sourceText":"Beer","sourceLanguage":"en","targetLanguage":"fr","targetText":"bières"}

IMPROVEMENT :
  * move everything (div tabs) externally so applications will have only to one reference the translate.js and this one will add dynamically the tabs element with forms.
  * add a list box with more target languages.




About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published