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

com.mytaxi.apis.phrase.api.translation.PhraseTranslationMapper 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.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