Skip to content

Commit 8716ee4

Browse files
authored
fix: fixed outputs (#809)
1 parent df576ef commit 8716ee4

24 files changed

+37
-36
lines changed

src/main/java/com/crowdin/cli/commands/Actions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ NewAction<PropertiesWithFiles, ProjectClient> listSources(
3939
boolean deleteObsolete, String branchName, boolean noProgress, boolean treeView, boolean plainView);
4040

4141
NewAction<PropertiesWithFiles, ProjectClient> listTranslations(
42-
boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang);
42+
boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang, boolean isUpload);
4343

4444
NewAction<ProjectProperties, ProjectClient> listLanguages(BaseCli.LanguageCode code, boolean all, boolean noProgress, boolean plainView);
4545

src/main/java/com/crowdin/cli/commands/actions/BundleDownloadAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void act(Outputter out, ProjectProperties pb, ClientBundle client) {
6464

6565
for (String file: extractedPaths) {
6666
String filePath = Utils.noSepAtStart(StringUtils.removeStart(file, baseTempDir.getAbsolutePath()));
67-
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.extracted_file"), filePath)));
67+
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.file_path"), filePath)));
6868
}
6969

7070
if (!keepArchive) {

src/main/java/com/crowdin/cli/commands/actions/CliActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public NewAction<PropertiesWithFiles, ProjectClient> listSources(
6060

6161
@Override
6262
public NewAction<PropertiesWithFiles, ProjectClient> listTranslations(
63-
boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang
63+
boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang, boolean isUpload
6464
) {
65-
return new ListTranslationsAction(noProgress, treeView, isLocal, plainView, useServerSources, withInContextLang);
65+
return new ListTranslationsAction(noProgress, treeView, isLocal, plainView, useServerSources, withInContextLang, isUpload);
6666
}
6767

6868
@Override

src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
250250
if (!plainView) {
251251
out.println(OK.withIcon(
252252
String.format(
253-
RESOURCE_BUNDLE.getString("message.extracted_file"),
253+
RESOURCE_BUNDLE.getString("message.file_path"),
254254
StringUtils.removeStart(toFile.getAbsolutePath(), pb.getBasePath()))));
255255
} else {
256256
out.println(StringUtils.removeStart(toFile.getAbsolutePath(), pb.getBasePath()));

src/main/java/com/crowdin/cli/commands/actions/DownloadSourcesAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void act(Outputter out, PropertiesWithFiles properties, ProjectClient cli
200200

201201
if (downloaded || dryrun) {
202202
if (!plainView) {
203-
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.downloaded_file"), filePath)));
203+
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.file_path"), filePath)));
204204
} else {
205205
out.println(filePath);
206206
}

src/main/java/com/crowdin/cli/commands/actions/FileUploadTranslationAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
8686

8787
if (!plainView) {
8888
out.println(OK.withIcon(String.format(
89-
RESOURCE_BUNDLE.getString("message.translation_uploaded"), file.getPath())));
89+
RESOURCE_BUNDLE.getString("message.uploading_file"), file.getPath())));
9090
} else {
9191
out.println(file.getPath());
9292
}

src/main/java/com/crowdin/cli/commands/actions/ListTranslationsAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ class ListTranslationsAction implements NewAction<PropertiesWithFiles, ProjectCl
2525
private boolean plainView;
2626
private boolean useServerSources;
2727
private boolean withInContextLang;
28+
private boolean isUpload;
2829

29-
public ListTranslationsAction(boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang) {
30+
public ListTranslationsAction(boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang, boolean isUpload) {
3031
this.noProgress = noProgress;
3132
this.treeView = treeView;
3233
this.isLocal = isLocal;
3334
this.plainView = plainView;
3435
this.useServerSources = useServerSources;
3536
this.withInContextLang = withInContextLang;
37+
this.isUpload = isUpload;
3638
}
3739

3840
@Override
@@ -54,7 +56,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
5456
PlaceholderUtil placeholderUtil = new PlaceholderUtil(
5557
project.getSupportedLanguages(), project.getProjectLanguages(!isLocal), pb.getBasePath());
5658

57-
(new DryrunTranslations(pb, project.getLanguageMapping(), placeholderUtil, project.getProjectLanguages(withInContextLang), false, files, useServerSources))
59+
(new DryrunTranslations(pb, project.getLanguageMapping(), placeholderUtil, project.getProjectLanguages(withInContextLang), false, files, useServerSources, isUpload))
5860
.run(out, treeView, plainView);
5961
}
6062
}

src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
168168
}
169169
if (!plainView) {
170170
out.println(OK.withIcon(String.format(
171-
RESOURCE_BUNDLE.getString("message.translation_uploaded"),
171+
RESOURCE_BUNDLE.getString("message.uploading_file"),
172172
StringUtils.removeStart(translationFile.getAbsolutePath(), pb.getBasePath()))));
173173
} else {
174174
out.println(StringUtils.removeStart(translationFile.getAbsolutePath(), pb.getBasePath()));
@@ -218,7 +218,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
218218
}
219219
if (!plainView) {
220220
out.println(OK.withIcon(String.format(
221-
RESOURCE_BUNDLE.getString("message.translation_uploaded"),
221+
RESOURCE_BUNDLE.getString("message.uploading_file"),
222222
StringUtils.removeStart(translationFile.getAbsolutePath(), pb.getBasePath()))));
223223
} else {
224224
out.println(StringUtils.removeStart(translationFile.getAbsolutePath(), pb.getBasePath()));

src/main/java/com/crowdin/cli/commands/functionality/BranchUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static Branch getOrCreateBranch(Outputter out, String branchName, Project
3636
request.setTitle(branchName);
3737
Branch newBranch = client.addBranch(request);
3838
if (!plainView) {
39-
out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.branch.list"), newBranch.getId(), newBranch.getName())));
39+
out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.branch"), branchName)));
4040
}
4141
project.addBranchToLocalList(newBranch);
4242
return newBranch;

src/main/java/com/crowdin/cli/commands/functionality/Dryrun.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public abstract class Dryrun {
1616
private String messageKey;
1717

1818
protected Dryrun() {
19-
this("message.uploading_file");
19+
this("message.file_path");
2020
}
2121

2222
protected Dryrun(String messageKey) {
@@ -37,7 +37,7 @@ public void run(Outputter out, boolean treeView, boolean plainView) {
3737
DrawTree.draw(files).forEach(out::println);
3838
} else {
3939
if (!plainView) {
40-
files.forEach(file -> out.println(String.format(RESOURCE_BUNDLE.getString(messageKey), file)));
40+
files.forEach(file -> out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString(messageKey), file))));
4141
} else {
4242
files.forEach(out::println);
4343
}

src/main/java/com/crowdin/cli/commands/functionality/DryrunObsoleteSources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DryrunObsoleteSources extends Dryrun {
2222
private List<File> files;
2323

2424
public DryrunObsoleteSources(@NonNull PropertiesWithFiles pb, @NonNull PlaceholderUtil placeholderUtil, @NonNull Map<Long, Directory> directories, @NonNull List<File> files) {
25-
super("message.obsolete_file");
25+
super("message.delete_obsolete.obsolete_file_delete");
2626
this.pb = pb;
2727
this.placeholderUtil = placeholderUtil;
2828
this.directories = directories;

src/main/java/com/crowdin/cli/commands/functionality/DryrunSources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class DryrunSources extends Dryrun {
1414
private PlaceholderUtil placeholderUtil;
1515

1616
public DryrunSources(PropertiesWithFiles pb, PlaceholderUtil placeholderUtil) {
17-
super("message.file_path");
17+
super("message.uploading_file");
1818
this.pb = pb;
1919
this.placeholderUtil = placeholderUtil;
2020
}

src/main/java/com/crowdin/cli/commands/functionality/DryrunTranslations.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ public class DryrunTranslations extends Dryrun {
2525

2626
public DryrunTranslations(
2727
PropertiesWithFiles pb, LanguageMapping projectLanguageMapping, PlaceholderUtil placeholderUtil,
28-
List<Language> languages, boolean filesMustExist, Map<String, File> projectSources, boolean useServerSources
28+
List<Language> languages, boolean filesMustExist, Map<String, File> projectSources, boolean useServerSources, boolean isUpload
2929
) {
30-
super("message.file_path");
30+
31+
super(isUpload ? "message.uploading_file" : "message.file_path");
3132
this.pb = pb;
3233
this.placeholderUtil = placeholderUtil;
3334
this.filesMustExist = filesMustExist;

src/main/java/com/crowdin/cli/commands/picocli/ConfigTranslationsSubcommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ConfigTranslationsSubcommand extends ActCommandWithFiles {
2020

2121
@Override
2222
protected NewAction<PropertiesWithFiles, ProjectClient> getAction(Actions actions) {
23-
return actions.listTranslations(this.noProgress, this.treeView, false, this.plainView, false, true);
23+
return actions.listTranslations(this.noProgress, this.treeView, false, this.plainView, false, true, false);
2424
}
2525

2626
@Override

src/main/java/com/crowdin/cli/commands/picocli/DownloadSubcommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class DownloadSubcommand extends ActCommandWithFiles {
6363
@Override
6464
protected NewAction<PropertiesWithFiles, ProjectClient> getAction(Actions actions) {
6565
return (dryrun)
66-
? actions.listTranslations(noProgress, treeView, false, plainView, all, true)
66+
? actions.listTranslations(noProgress, treeView, false, plainView, all, true, false)
6767
: actions.download(new FsFiles(), noProgress, languageIds, excludeLanguageIds, pseudo, branchName, ignoreMatch, isVerbose, plainView, all, keepArchive);
6868
}
6969

src/main/java/com/crowdin/cli/commands/picocli/UploadTranslationsSubcommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class UploadTranslationsSubcommand extends ActCommandWithFiles {
3939
@Override
4040
protected NewAction<PropertiesWithFiles, ProjectClient> getAction(Actions actions) {
4141
return (dryrun)
42-
? actions.listTranslations(noProgress, treeView, true, plainView, false, false)
42+
? actions.listTranslations(noProgress, treeView, true, plainView, false, false, true)
4343
: actions.uploadTranslations(noProgress, languageId, branch, importEqSuggestions, autoApproveImported, translateHidden, debug, plainView);
4444
}
4545

src/main/resources/messages/messages.properties

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ message.build_archive=Building ZIP archive with the latest translations
646646
message.build_archive_pseudo=Building ZIP archive with the pseudo-localized translation files
647647
message.building_translation=Building translation (%d%%)
648648
message.building_reviewed_sources=Building reviewed sources (%d%%)
649-
message.extracted_file=Extracted: '%s'
650649
message.archive=Archive: '%s'
651650
message.downloaded_files_omitted=Downloaded translations don't match the current project configuration. The translations for the following sources will be omitted (use --verbose to get the list of the omitted translations)\:
652651
message.downloaded_files_omitted_without_sources=Due to missing respective sources, the following translations will be omitted\:
@@ -665,7 +664,6 @@ message.ask_is_enterprise=For Crowdin Enterprise
665664
message.ask_auth_via_browser=Authorize via browser?
666665
message.ask_organization_name=Your organization name
667666
message.configuration_ok=@|green Your configuration file looks good|@
668-
message.translation_uploaded=@|green Translation file '%s' has been uploaded|@
669667
message.branch_deleted=@|green Branch '%s' deleted|@
670668
message.branch_already_exists=Branch '%s' already exists in the project
671669
message.branch_does_not_exist=Branch '%s' doesn't exist in the project
@@ -674,10 +672,9 @@ message.translation=Translated:
674672
message.approval=Proofread:
675673
message.language=@|yellow %s|@(@|yellow %s|@):
676674
message.translation_progress=\tTranslated: %d%% (Words: %d/%d, Phrases: %d/%d)
677-
message.approval_progress=\tApproved: %d%% (Words: %d/%d, Phrases: %d/%d)
675+
message.approval_progress=\tProofread: %d%% (Words: %d/%d, Phrases: %d/%d)
678676
message.already_uploaded=Skipping file '%s' because it is already uploading/uploaded
679677
message.extracted_organization_name=Extracted organization name from provided url: %s
680-
message.obsolete_file=Obsolete file '%s'
681678
message.file_deleted=@|green File '%s' deleted|@
682679
message.no_file_string_project=File management is not available for string-based projects
683680

@@ -686,6 +683,7 @@ message.download_translations.preserve_hierarchy_warning=Because the 'preserve_h
686683

687684
message.language.list=@|yellow %s|@ @|green %s|@
688685

686+
message.branch=Branch '%s'
689687
message.branch.list=@|yellow #%d|@ @|green %s|@
690688
message.branch.merge=@|green Merged branch '%s' into '%s'|@
691689
message.branch.merge_details=\tMerge summary: %s
@@ -706,11 +704,11 @@ message.source_string_list_not_found=No strings found
706704
message.glossary.download_success=@|green '%s' downloaded successfully|@
707705
message.glossary.list=@|yellow #%d|@ @|green %s|@ (@|red terms: %d|@)
708706
message.glossary.list_term=\t@|yellow #%d|@ @|green %s|@: %s
709-
message.glossary.import_success=@|green Imported in @|yellow #%s|@ @|green '%s'|@ glossary|@
707+
message.glossary.import_success=Imported in @|yellow #%s|@ @|green '%s'|@ glossary
710708

711709
message.tm.download_success=@|green '%s' downloaded successfully|@
712710
message.tm.list=@|yellow #%d|@ %s (@|green segments: %d|@)
713-
message.tm.import_success=@|green Imported in @|yellow #%s|@ @|green '%s'|@ translation memory|@
711+
message.tm.import_success=Imported in @|yellow #%s|@ @|green '%s'|@ translation memory
714712
message.tm.list_empty=No translation memories found
715713

716714
message.screenshot.deleted=@|green Screenshot '%s' deleted successfully|@
@@ -745,9 +743,9 @@ message.label.list_empty=No labels found
745743
message.label.already_exists=Label '%s' already exists in the project
746744
message.label.deleted=@|green Label '%s' deleted successfully|@
747745

748-
message.delete_obsolete.obsolete_file_delete=Obsolete file '%s' was deleted
746+
message.delete_obsolete.obsolete_file_delete='%s' file was deleted
749747
message.delete_obsolete.obsolete_directory_delete=No obsolete files were found
750-
message.delete_obsolete.no_obsolete_files_found=Obsolete directory '%s' was deleted
748+
message.delete_obsolete.no_obsolete_files_found='%s' directory was deleted
751749
message.delete_obsolete.no_obsolete_directories_found=No obsolete directories found
752750

753751
message.html_page.title=Crowdin CLI - Authentication

src/test/java/com/crowdin/cli/commands/actions/CliActionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void testListSources() {
3939

4040
@Test
4141
public void testListTranslations() {
42-
assertNotNull(actions.listTranslations(false, false, false, false, false, false));
42+
assertNotNull(actions.listTranslations(false, false, false, false, false, false, false));
4343
}
4444

4545
@Test

src/test/java/com/crowdin/cli/commands/actions/DownloadSourcesActionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public void testDryRun() {
338338
action.act(Outputter.getDefault(), pb, client);
339339

340340
String outMessage1 = OK.withIcon("Fetching project info");
341-
String outMessage2 = OK.withIcon(String.format("@|green File 'common%sstrings.xml'|@", File.separator));
341+
String outMessage2 = OK.withIcon(String.format("common%sstrings.xml", File.separator));
342342

343343
client.downloadFullProject(null);
344344
client.downloadFile(101L);

src/test/java/com/crowdin/cli/commands/actions/ListTranslationsActionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void testForServerInteraction() throws ResponseException {
4646
.thenReturn(ProjectBuilder.emptyProject(Long.parseLong(pb.getProjectId()))
4747
.addFile("first.po", "gettext", 101L, null, null).build());
4848

49-
NewAction<PropertiesWithFiles, ProjectClient> action = new ListTranslationsAction(false, false, false, false, false, false);
49+
NewAction<PropertiesWithFiles, ProjectClient> action = new ListTranslationsAction(false, false, false, false, false, false, false);
5050
action.act(Outputter.getDefault(), pb, client);
5151

5252
verify(client).downloadFullProject();

src/test/java/com/crowdin/cli/commands/picocli/ConfigTranslationsSubcommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class ConfigTranslationsSubcommandTest extends PicocliTestUtils {
1111
public void testListTranslations() {
1212
this.execute(CommandNames.CONFIG, CommandNames.TRANSLATIONS);
1313
verify(actionsMock)
14-
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
14+
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
1515
this.check(true);
1616
}
1717
}

src/test/java/com/crowdin/cli/commands/picocli/DownloadSubcommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void testDownload() {
2626
public void testDownloadDryrun() {
2727
this.execute(CommandNames.DOWNLOAD, "--dryrun");
2828
verify(actionsMock)
29-
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
29+
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
3030
this.check(true);
3131
}
3232

src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void mockActions() {
6464
.thenReturn(actionMock);
6565
when(actionsMock.listSources(anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean()))
6666
.thenReturn(actionMock);
67-
when(actionsMock.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()))
67+
when(actionsMock.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()))
6868
.thenReturn(actionMock);
6969
when(actionsMock.status(anyBoolean(), any(), any(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()))
7070
.thenReturn(actionMock);

src/test/java/com/crowdin/cli/commands/picocli/UploadTranslationsSubcommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void testUploadTranslations() {
2020
public void testUploadTranslationsDryrun() {
2121
this.execute(CommandNames.UPLOAD, CommandNames.UPLOAD_TRANSLATIONS, "--dryrun");
2222
verify(actionsMock)
23-
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
23+
.listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean());
2424
this.check(true);
2525
}
2626
}

0 commit comments

Comments
 (0)