Skip to content

Commit 501e2a1

Browse files
Merge pull request #122 from simplelocalize/dev
Update reflection config
2 parents 5f5e11f + 68e2931 commit 501e2a1

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

.github/workflows/run-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
restore-keys: ${{ runner.os }}-sonar
3737
- name: "Test with Maven"
3838
run: mvn --settings .maven.xml clean install -B -V
39-
- name: "SonarCloud Analyze"
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43-
run: mvn clean -B verify -Ptest org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
39+
# - name: "SonarCloud Analyze"
40+
# env:
41+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
# run: mvn clean -B verify -Ptest org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

reflect-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"parameterTypes": [
3838
"java.lang.String",
3939
"java.util.List",
40+
"java.util.List",
41+
"java.lang.Boolean",
4042
"java.lang.String"
4143
]
4244
},
@@ -52,6 +54,7 @@
5254
"java.lang.Boolean",
5355
"java.lang.Boolean",
5456
"java.lang.Boolean",
57+
"java.lang.Boolean",
5558
"java.lang.String"
5659
] },
5760
{ "name" : "purge", "parameterTypes" : ["java.lang.String", "java.lang.String", "java.lang.Boolean"] }

src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ public void pull(
316316
public void autoTranslate(
317317
@Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
318318
@Option(names = {"--autoTranslateLanguageKey", "--languageKey", "--languageKeys"}, description = "(Optional) Project language keys to auto-translate", split = ",") List<String> languageKeys,
319-
@Option(names = {"--force"}, description = "(Optional) Force auto-translation for all translations") Boolean forceAutoTranslate,
320319
@Option(names = {"--autoTranslateOptions", "--options"}, description = "(Optional) Auto-translate options") List<String> autoTranslateOptions,
320+
@Option(names = {"--force"}, description = "(Optional) Force auto-translation for all translations") Boolean forceAutoTranslate,
321321
@Option(names = {"--baseUrl"}, description = "(Optional) Set custom server URL") String baseUrl
322322
)
323323
{
@@ -351,8 +351,6 @@ public void autoTranslate(
351351
effectiveAutoTranslateOptions.add("FORCE_REPLACE");
352352
}
353353
configuration.setAutoTranslateOptions(effectiveAutoTranslateOptions);
354-
355-
configuration.setAutoTranslateOptions(autoTranslateOptions);
356354
this.effectiveCommandConfiguration = configuration;
357355
SimpleLocalizeClient client = SimpleLocalizeClient.create(configuration.getBaseUrl(), configuration.getApiKey());
358356
AutoTranslationCommand command = new AutoTranslationCommand(client, configuration);

src/main/java/io/simplelocalize/cli/client/SimpleLocalizeClient.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package io.simplelocalize.cli.client;
22

3+
import com.fasterxml.jackson.core.JsonProcessingException;
34
import com.fasterxml.jackson.databind.ObjectMapper;
5+
import com.fasterxml.jackson.databind.SerializationFeature;
46
import com.jayway.jsonpath.DocumentContext;
57
import com.jayway.jsonpath.JsonPath;
68
import com.jayway.jsonpath.Option;
@@ -82,7 +84,15 @@ public String previewFile(UploadRequest uploadRequest) throws IOException, Inter
8284
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
8385
throwOnError(httpResponse);
8486
DocumentContext json = JsonPath.parse(httpResponse.body());
85-
return json.read("$.data", String.class);
87+
return prettyPrintJson(json);
88+
}
89+
90+
private String prettyPrintJson(DocumentContext json) throws JsonProcessingException
91+
{
92+
Object data = json.read("$.data");
93+
ObjectMapper mapper = new ObjectMapper();
94+
mapper.enable(SerializationFeature.INDENT_OUTPUT);
95+
return mapper.writeValueAsString(data);
8696
}
8797

8898
public List<DownloadableFile> exportFiles(ExportRequest exportRequest) throws IOException, InterruptedException

0 commit comments

Comments
 (0)