use of org.activityinfo.i18n.tools.po.PoEditorClient in project activityinfo by bedatadriven.
the class PoEditorSource method updateTerms.
/**
* Updates the translation source, adding any missing terms and their default
* translations.
*
* @param terms
*/
public void updateTerms(List<ResourceClassTerm> terms, boolean sync) throws IOException {
List<PoTermUpdate> updates = Lists.newArrayList();
for (ResourceClassTerm term : terms) {
updates.add(new PoTermUpdate(term.getKey(), term.getDefaultTranslation()));
}
PoEditorClient client = new PoEditorClient(apiToken);
PoUploadResponse response = client.upload(projectId, updates, sync);
PoUploadResponse.Details details = response.getDetails();
System.out.println(String.format("Terms: %5d Added: %5d Deleted: %d", details.getTerms().getParsed(), details.getTerms().getAdded(), details.getTerms().getDeleted()));
System.out.println(String.format("Definitions: %5d Added: %5d Updated: %d", details.getDefinitions().getParsed(), details.getDefinitions().getAdded(), details.getDefinitions().getUpdated()));
}
Aggregations