All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mytaxi.apis.phrase.api.locale.PhraseLocaleMapper Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.6
Show newest version
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