Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.simplelocalize</groupId>
<artifactId>simplelocalize-cli</artifactId>
<version>2.11.0</version>
<version>2.11.1</version>
<packaging>jar</packaging>
<name>simplelocalize-cli</name>
<description>Official SimpleLocalize Command Line Interface</description>
Expand Down
14 changes: 14 additions & 0 deletions reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@
"allDeclaredMethods" : true,
"allPublicMethods" : true
},
{
"name" : "io.simplelocalize.cli.client.dto.proxy.Mappings",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true
},
{
"name" : "io.simplelocalize.cli.client.dto.proxy.LanguageTransform",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true
},
{
"name" : "io.simplelocalize.cli.client.dto.proxy.DownloadableFile",
"allDeclaredConstructors" : true,
Expand Down
2 changes: 1 addition & 1 deletion simplelocalize-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uploadFormat: multi-language-json
# Upload options are options that are passed to the upload command.
# Supported options: https://simplelocalize.io/docs/general/options/
uploadOptions:
- 'REPLACE_TRANSLATION_IF_FOUND' # overwrite translation for given a key and namespace if found
- 'UPDATE_TRANSLATIONS'


###################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void upload(

if (Boolean.TRUE.equals(updateTranslations))
{
effectiveUploadOptions.add("REPLACE_TRANSLATION_IF_FOUND");
effectiveUploadOptions.add("UPDATE_TRANSLATIONS");
}

if (Boolean.TRUE.equals(delete))
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/simplelocalize/cli/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class Version
{

public static final String NUMBER = "2.11.0";
public static final String NUMBER = "2.11.1";

private Version()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,42 @@ void shouldLoadConfiguration() throws Exception
Assertions.assertThat(configuration.getIgnoreKeys()).containsExactlyInAnyOrder("key one", "key_two");
}

@Test
void shouldLoadLanguageMappingsFromConfiguration() throws Exception
{
//given
ClassLoader classLoader = getClass().getClassLoader();
String pathToConfig = classLoader.getResource("simplelocalize.yml").toURI().toString().replace("file:", "");
Path configurationFilePath = Path.of(pathToConfig);

//when
Configuration configuration = loader.loadOrGetDefault(configurationFilePath);

//then
Assertions.assertThat(configuration.getMappings()).isNotNull();
Assertions.assertThat(configuration.getMappings().getLang())
.extracting(LanguageTransform::getLanguageKey, LanguageTransform::getPlaceholder)
.containsExactlyInAnyOrder(
Tuple.tuple("en", "english"),
Tuple.tuple("pl_PL", "polish"));
}

@Test
void shouldDefaultToEmptyMappingsWhenNotProvidedInConfiguration() throws Exception
{
//given
ClassLoader classLoader = getClass().getClassLoader();
String pathToConfig = classLoader.getResource("simplelocalize-upload-download.yml").toURI().toString().replace("file:", "");
Path configurationFilePath = Path.of(pathToConfig);

//when
Configuration configuration = loader.loadOrGetDefault(configurationFilePath);

//then
Assertions.assertThat(configuration.getMappings()).isNotNull();
Assertions.assertThat(configuration.getMappings().getLang()).isEmpty();
}

@Test
void shouldThrowErrorWhenInvalidFile() throws Exception
{
Expand Down
Loading