Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/freenowtech/phrase-java-client

This Project is a Java based api client for phraseapp.com to pull translations
https://github.com/freenowtech/phrase-java-client

Last synced: 10 days ago
JSON representation

This Project is a Java based api client for phraseapp.com to pull translations

Awesome Lists containing this project

README

        

# Phrase-Java-Client
[![Build Status](https://github.com/freenowtech/phrase-java-client/actions/workflows/maven.yml/badge.svg?query=branch%3Amaster)](https://github.com/freenowtech/phrase-java-client/actions?query=branch%3Amaster)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.free-now.apis/phrase-java-client/badge.svg?x=1)](https://maven-badges.herokuapp.com/maven-central/com.free-now.apis/phrase-java-client)
## What is this?
This projects contains of services to handle the translations from [PhraseApp API v2](http://docs.phraseapp.com/api/v2/).
It's supposed to expose Phrase translations as POJO or as File within the java world.

## This project consists of 3 main phraseApp services:
- `PhraseLocaleAPI:` Downloads the locales from phraseApp as POJOs.
- `PhraseLocaleDownloadAPI:` Downloads the translations from phraseApp as file(byte[]).
- `PhraseTranslationAPI:` Downloads the translations from phraseApp as POJOs.

## How to use this project
Currently this project is not released in the maven central repository.
Please install this dependency to your local repository and include the following dependency:
```

com.free-now.apis
phrase-java-client
${phrase-java-client.version}

```

**Note:** Starting with version 2.0.0, the root package has been changed from `com.mytaxi.apis.phrase` to
`com.freenow.apis.phrase` and all usages of the library must be updated to the new package.

## What you have to do to start it in an spring application?

### Create the bean PhraseAppSyncTask to run this job scheduled lately.

@Bean
public PhraseAppSyncTask phraseAppSyncTask(final PhraseConfig config)
{
return new PhraseAppSyncTask(config.getAuthToken(), config.getProjectId());
}

### Create a scheduling to run this job frequently.

@Scheduled(fixedRate = 120000)
public void updatePhraseAppStringsTask()
{
try
{
final PhraseAppSyncTask phraseAppSyncTask = applicationContext.getBean("phraseAppSyncTask",
PhraseAppSyncTask.class);
phraseAppSyncTask.run();
ResourceBundle.clearCache();
}
catch (final Exception e)
{
LOG.error("Error downloading PhraseApp messages due auto sync task!", e);
}
}

## Developers
In order to make the test work create a file `/src/test/resources/com/freenow/phraseapi/config/TestConfig.properties` with the content
```properties
authToken=
projectId=
localeIdDe=
```

### Deploy to OSS Sonatype
```
export authToken=
export projectId=
export localeIdDe=
mvn release:prepare -P release
mvn release:perform -P release
```

## TODOs
- add tests for main functionality of the services localedownload, translation