com.mytaxi.apis.phrase.api.translation.PhraseTranslationMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phrase-java-client Show documentation
Show all versions of phrase-java-client Show documentation
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.
package com.mytaxi.apis.phrase.api.translation;
import com.mytaxi.apis.phrase.api.locale.PhraseLocaleMapper;
import com.mytaxi.apis.phrase.api.translation.dto.PhraseTranslationDTO;
import com.mytaxi.apis.phrase.domainobject.translation.PhraseTranslation;
import java.util.ArrayList;
import java.util.List;
/**
* Created by m.winkelmann on 11.11.15.
*/
public class PhraseTranslationMapper
{
public static List makePhraseTranslations(PhraseTranslationDTO[] requestedTranslations)
{
ArrayList phraseTranslations = new ArrayList();
for (PhraseTranslationDTO requestedPhraseTranslation : requestedTranslations)
{
phraseTranslations.add(makePhraseTranslation(requestedPhraseTranslation));
}
return phraseTranslations;
}
private static PhraseTranslation makePhraseTranslation(PhraseTranslationDTO requestedPhraseTranslation)
{
PhraseTranslation.Builder builder = PhraseTranslation.newBuilder()
.withId(requestedPhraseTranslation.getId())
.withKey(requestedPhraseTranslation.getKey().getName())
.withLocale(PhraseLocaleMapper.makePhraseLocale(requestedPhraseTranslation.getLocale()))
.withTranslation(requestedPhraseTranslation.getTranslation());
return builder.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy