Package org.zanata.service

Examples of org.zanata.service.TranslationService.translate()


        TransUnitUpdateRequest translateReq =
                new TransUnitUpdateRequest(transUnitId, newContents,
                        ContentState.Approved, 1);

        List<TranslationResult> result =
                transService.translate(new LocaleId("de"),
                        Lists.newArrayList(translateReq));

        assertThat(result.get(0).isTranslationSuccessful(), is(true));
        assertThat(result.get(0).getBaseVersionNum(), is(1));
        assertThat(result.get(0).getBaseContentState(),
View Full Code Here


        newContents.add("translated 2");
        translationReqs.add(new TransUnitUpdateRequest(transUnitId,
                newContents, ContentState.NeedReview, 0));

        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));
View Full Code Here

        // Should not pass as the base version (1) does not match
        List<TransUnitUpdateRequest> translationRequests =
                Lists.newArrayList(translateReq);
        List<TranslationResult> result =
                transService.translate(new LocaleId("de"), translationRequests);

        assertThat(result.get(0).isTranslationSuccessful(), Matchers.is(false));
    }

    @Test
View Full Code Here

        TransUnitUpdateRequest translateReq =
                new TransUnitUpdateRequest(transUnitId, Lists.newArrayList("a",
                        "b"), ContentState.Approved, 0);

        List<TranslationResult> result =
                transService.translate(new LocaleId("de"),
                        Lists.newArrayList(translateReq));

        verify(identity).checkPermission(eq("translation-review"),
                isA(HProject.class), isA(HLocale.class));
        assertThat(result.get(0).isTranslationSuccessful(), is(true));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.