com.mytaxi.apis.phrase.api.locale.PhraseLocaleMapper 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.locale;
import com.mytaxi.apis.phrase.api.locale.dto.PhraseLocaleDTO;
import com.mytaxi.apis.phrase.domainobject.locale.PhraseLocale;
import com.mytaxi.apis.phrase.domainobject.locale.PhraseProjectLocale;
import java.util.ArrayList;
import java.util.List;
/**
* Created by m.winkelmann on 11.11.15.
*/
public class PhraseLocaleMapper
{
public static PhraseProjectLocale makePhraseProjectLocale(String projectId, PhraseLocaleDTO[] requestedLocales)
{
PhraseProjectLocale.Builder builder = PhraseProjectLocale.newBuilder();
builder.withProjectId(projectId);
builder.withLocales(makePhraseLocales(requestedLocales));
return builder.build();
}
public static List makePhraseLocales(PhraseLocaleDTO[] requestedLocales)
{
List locales = new ArrayList(requestedLocales.length);
for (PhraseLocaleDTO localeDTO : requestedLocales)
{
locales.add(makePhraseLocale(localeDTO));
}
return locales;
}
public static PhraseLocale makePhraseLocale(PhraseLocaleDTO localeDTO)
{
return PhraseLocale.newBuilder().withId(localeDTO.getId()).withName(localeDTO.getName()).withCode(localeDTO.getCode()).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy