Package org.zanata.service.TranslationService

Examples of org.zanata.service.TranslationService.TranslationResult


        List<TranslationResult> translationResults =
                translationServiceImpl.translate(new LocaleId(localeId),
                        Lists.newArrayList(request));

        TranslationResult result = translationResults.get(0);

        if (result.isVersionNumConflict()) {
            return Response.status(Response.Status.CONFLICT).build();
        } else if (!result.isTranslationSuccessful()) {
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                    .build();
        } else {
            requestData.setStatus(result.getTranslatedTextFlowTarget()
                    .getState());
            requestData.setRevision(result.getTranslatedTextFlowTarget()
                    .getVersionNum());
            return Response.ok(requestData).build();
        }
    }
View Full Code Here


        List<TranslationResult> results =
                transService.translate(new LocaleId("de"), translationReqs);

        // First result
        TranslationResult result = results.get(0);
        assertThat(result.isTranslationSuccessful(), is(true));
        assertThat(result.getBaseVersionNum(), is(1));
        assertThat(result.getBaseContentState(), is(ContentState.Translated)); // there
                                                                               // was
                                                                               // a
                                                                               // prvious
                                                                               // translation
        assertThat(result.getTranslatedTextFlowTarget().getVersionNum(), is(2)); // moved
                                                                                 // up
                                                                                 // a
                                                                                 // version

        // Second result
        result = results.get(1);
        assertThat(result.isTranslationSuccessful(), is(true));
        assertThat(result.getBaseVersionNum(), is(0));
        assertThat(result.getBaseContentState(), is(ContentState.New)); // no
                                                                        // previous
                                                                        // translation
        assertThat(result.getTranslatedTextFlowTarget().getVersionNum(), is(1)); // first
                                                                                 // version
    }
View Full Code Here

TOP

Related Classes of org.zanata.service.TranslationService.TranslationResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.