com.mytaxi.apis.phrase.api.format.JavaPropertiesFormat 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.format;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
/**
* See https://phraseapp.com/docs/guides/formats/java-properties/
*/
public class JavaPropertiesFormat implements Format
{
public static final String NAME = "properties";
private final List options;
private JavaPropertiesFormat(List options)
{
this.options = options;
}
@Override
public String getName()
{
return NAME;
}
@Override
public List getOptions()
{
return options;
}
public static Builder newBuilder()
{
return new Builder();
}
public static class Builder
{
private final List options = new ArrayList<>();
public Builder setEscapeSingleQuotes(boolean escapeSingleQuotes)
{
return setOption("escape_single_quotes", "" + escapeSingleQuotes);
}
public Builder setOption(String name, String value)
{
String fullName = String.format("format_options[%s]", name);
options.add(new BasicNameValuePair(fullName, value));
return this;
}
public JavaPropertiesFormat build()
{
return new JavaPropertiesFormat(options);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy