public TranslationsResource getTranslations ( final String id , final LocaleId locale ) throws NotModifiedException { ClientResponse < TranslationsResource > response = null ; try { final ITranslatedDocResource client = proxyFactory . getTranslatedDocResource ( details . getProject ( ) , details . getVersion ( ) ) ; response = client . getTranslations ( id , locale , null ) ; final Status status = Response . Status . fromStatusCode ( response . getStatus ( ) ) ; /* Remove the locale if it is forbidden */ if ( status == Response . Status . FORBIDDEN ) { localeManager . removeLocale ( locale ) ; } else if ( status == Status . NOT_MODIFIED ) { throw new NotModifiedException ( ) ; } else if ( status == Response . Status . OK ) { final TranslationsResource retValue = response . getEntity ( ) ; return retValue ; } } catch ( final Exception ex ) { if ( ex instanceof NotModifiedException ) { throw ( NotModifiedException ) ex ; } else { log . error ( "Failed to retrieve the Zanata Translated Document" , ex ) ; } } finally { /* * If you are using RESTEasy client framework, and returning a Response from your service method, you will * explicitly need to release the connection. */ if ( response != null ) response . releaseConnection ( ) ; /* Perform a small wait to ensure zanata isn't overloaded */ performZanataRESTCallWaiting ( ) ; } return null ; }
Get a Translation from Zanata using the Zanata Document ID and Locale .