From 1cb1d93603f3933ac403c9d765de3ebfb2002941 Mon Sep 17 00:00:00 2001 From: Yevheniy Oliynyk Date: Thu, 21 Mar 2024 11:04:29 +0100 Subject: [PATCH] feat: language list updates (#744) --- .../cli/client/CrowdinProjectClient.java | 10 ++++-- .../com/crowdin/cli/client/ProjectClient.java | 3 ++ .../com/crowdin/cli/commands/Actions.java | 2 +- .../cli/commands/actions/CliActions.java | 4 +-- ...gesAction.java => LanguageListAction.java} | 16 +++++++--- .../cli/commands/picocli/CommandNames.java | 2 +- ...mmand.java => LanguageListSubcommand.java} | 9 ++++-- .../commands/picocli/LanguageSubcommand.java | 16 ++++++++++ .../cli/commands/picocli/ListSubcommand.java | 3 +- .../cli/commands/picocli/RootCommand.java | 1 + .../resources/messages/messages.properties | 31 +++++++++++-------- ...nTest.java => LanguageListActionTest.java} | 18 +++++------ website/docs/releases/migration-4.md | 15 +++++++++ ...guages.adoc => crowdin-language-list.adoc} | 4 +-- website/mantemplates/crowdin-language.adoc | 16 ++++++++++ website/sidebars.js | 14 ++++++++- 16 files changed, 123 insertions(+), 41 deletions(-) rename src/main/java/com/crowdin/cli/commands/actions/{ListLanguagesAction.java => LanguageListAction.java} (87%) rename src/main/java/com/crowdin/cli/commands/picocli/{ListLanguagesSubcommand.java => LanguageListSubcommand.java} (73%) create mode 100644 src/main/java/com/crowdin/cli/commands/picocli/LanguageSubcommand.java rename src/test/java/com/crowdin/cli/commands/actions/{ListLanguagesActionTest.java => LanguageListActionTest.java} (80%) rename website/mantemplates/{crowdin-list-languages.adoc => crowdin-language-list.adoc} (90%) create mode 100644 website/mantemplates/crowdin-language.adoc diff --git a/src/main/java/com/crowdin/cli/client/CrowdinProjectClient.java b/src/main/java/com/crowdin/cli/client/CrowdinProjectClient.java index f718e92cf..9a75e0cbf 100644 --- a/src/main/java/com/crowdin/cli/client/CrowdinProjectClient.java +++ b/src/main/java/com/crowdin/cli/client/CrowdinProjectClient.java @@ -3,6 +3,7 @@ import com.crowdin.client.core.model.PatchRequest; import com.crowdin.client.labels.model.AddLabelRequest; import com.crowdin.client.labels.model.Label; +import com.crowdin.client.languages.model.Language; import com.crowdin.client.projectsgroups.model.ProjectSettings; import com.crowdin.client.projectsgroups.model.Type; import com.crowdin.client.sourcefiles.model.*; @@ -31,6 +32,12 @@ public CrowdinProjectClient(com.crowdin.client.Client client, long projectId) { this.projectId = projectId; } + @Override + public List listSupportedLanguages() { + return executeRequestFullList((limit, offset) -> this.client.getLanguagesApi() + .listSupportedLanguages(limit, offset)); + } + @Override public CrowdinProjectFull downloadFullProject(String branchName) { CrowdinProjectFull project = new CrowdinProjectFull(); @@ -75,8 +82,7 @@ private void populateProjectWithStructure(CrowdinProjectFull project, String bra } private void populateProjectWithLangs(CrowdinProject project) { - project.setSupportedLanguages(executeRequestFullList((limit, offset) -> this.client.getLanguagesApi() - .listSupportedLanguages(limit, offset))); + project.setSupportedLanguages(this.listSupportedLanguages()); } private void populateProjectWithInfo(CrowdinProjectInfo project) { diff --git a/src/main/java/com/crowdin/cli/client/ProjectClient.java b/src/main/java/com/crowdin/cli/client/ProjectClient.java index 9a0699456..62b1cb532 100644 --- a/src/main/java/com/crowdin/cli/client/ProjectClient.java +++ b/src/main/java/com/crowdin/cli/client/ProjectClient.java @@ -5,6 +5,7 @@ import com.crowdin.client.distributions.model.DistributionRelease; import com.crowdin.client.labels.model.AddLabelRequest; import com.crowdin.client.labels.model.Label; +import com.crowdin.client.languages.model.Language; import com.crowdin.client.sourcefiles.model.*; import com.crowdin.client.sourcestrings.model.*; import com.crowdin.client.stringcomments.model.AddStringCommentRequest; @@ -22,6 +23,8 @@ default CrowdinProjectFull downloadFullProject() { return this.downloadFullProject(null); } + List listSupportedLanguages(); + CrowdinProjectFull downloadFullProject(String branchName); CrowdinProject downloadProjectWithLanguages(); diff --git a/src/main/java/com/crowdin/cli/commands/Actions.java b/src/main/java/com/crowdin/cli/commands/Actions.java index 0f3f16d45..95a8e419c 100644 --- a/src/main/java/com/crowdin/cli/commands/Actions.java +++ b/src/main/java/com/crowdin/cli/commands/Actions.java @@ -42,7 +42,7 @@ NewAction listSources( NewAction listTranslations( boolean noProgress, boolean treeView, boolean isLocal, boolean plainView, boolean useServerSources, boolean withInContextLang); - NewAction listLanguages(BaseCli.LanguageCode code, boolean noProgress, boolean plainView); + NewAction listLanguages(BaseCli.LanguageCode code, boolean all, boolean noProgress, boolean plainView); NewAction status( boolean noProgress, String branchName, String languageId, String file, String directory, boolean isVerbose, boolean showTranslated, boolean showApproved, boolean failIfIncomplete); diff --git a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java index 08ebae504..1ff06171b 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java +++ b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java @@ -67,8 +67,8 @@ public NewAction listTranslations( } @Override - public NewAction listLanguages(BaseCli.LanguageCode code, boolean noProgress, boolean plainView) { - return new ListLanguagesAction(code, noProgress, plainView); + public NewAction listLanguages(BaseCli.LanguageCode code, boolean all, boolean noProgress, boolean plainView) { + return new LanguageListAction(code, all, noProgress, plainView); } @Override diff --git a/src/main/java/com/crowdin/cli/commands/actions/ListLanguagesAction.java b/src/main/java/com/crowdin/cli/commands/actions/LanguageListAction.java similarity index 87% rename from src/main/java/com/crowdin/cli/commands/actions/ListLanguagesAction.java rename to src/main/java/com/crowdin/cli/commands/actions/LanguageListAction.java index dca259f10..fcf320884 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/ListLanguagesAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/LanguageListAction.java @@ -10,6 +10,8 @@ import com.crowdin.cli.utils.console.ConsoleSpinner; import com.crowdin.client.languages.model.Language; +import java.util.List; + import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; import static com.crowdin.cli.utils.PlaceholderUtil.PLACEHOLDER_ANDROID_CODE; import static com.crowdin.cli.utils.PlaceholderUtil.PLACEHOLDER_LOCALE; @@ -20,14 +22,16 @@ import static com.crowdin.cli.utils.console.ExecutionStatus.OK; import static com.crowdin.cli.utils.console.ExecutionStatus.WARNING; -class ListLanguagesAction implements NewAction { +class LanguageListAction implements NewAction { private BaseCli.LanguageCode code; + private boolean all; private boolean noProgress; private boolean plainView; - public ListLanguagesAction(BaseCli.LanguageCode code, boolean noProgress, boolean plainView) { + public LanguageListAction(BaseCli.LanguageCode code, boolean all, boolean noProgress, boolean plainView) { this.code = code; + this.all = all; this.noProgress = noProgress || plainView; this.plainView = plainView; } @@ -47,13 +51,15 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien } LanguageMapping langMapping = project.getLanguageMapping(); + List languages = this.all ? client.listSupportedLanguages() : project.getProjectLanguages(true); + if (!plainView) { - project.getProjectLanguages(true).stream() - .map(lang -> String.format(RESOURCE_BUNDLE.getString("message.description"), lang.getName(), this.getCode(langMapping, lang))) + languages.stream() + .map(lang -> String.format(RESOURCE_BUNDLE.getString("message.language.list"), this.getCode(langMapping, lang), lang.getName())) .map(OK::withIcon) .forEach(out::println); } else { - project.getProjectLanguages(true).stream() + languages.stream() .map(lang -> this.getCode(langMapping, lang)) .forEach(out::println); } diff --git a/src/main/java/com/crowdin/cli/commands/picocli/CommandNames.java b/src/main/java/com/crowdin/cli/commands/picocli/CommandNames.java index 963eb212f..d8ad93131 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/CommandNames.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/CommandNames.java @@ -19,7 +19,6 @@ public final class CommandNames { public static final String LIST_PROJECT = "project"; public static final String LIST_SOURCES = "sources"; public static final String LIST_TRANSLATIONS = "translations"; - public static final String LIST_LANGUAGES = "languages"; public static final String STATUS = "status"; public static final String STATUS_TRANSLATION = "translation"; @@ -74,4 +73,5 @@ public final class CommandNames { public static final String FILE_UPLOAD = "upload"; public static final String FILE_DOWNLOAD = "download"; public static final String FILE_DELETE = "delete"; + public static final String LANGUAGE = "language"; } diff --git a/src/main/java/com/crowdin/cli/commands/picocli/ListLanguagesSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/LanguageListSubcommand.java similarity index 73% rename from src/main/java/com/crowdin/cli/commands/picocli/ListLanguagesSubcommand.java rename to src/main/java/com/crowdin/cli/commands/picocli/LanguageListSubcommand.java index d256a00ed..f59e86f52 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/ListLanguagesSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/LanguageListSubcommand.java @@ -8,20 +8,23 @@ import picocli.CommandLine; @CommandLine.Command( - name = CommandNames.LIST_LANGUAGES, + name = CommandNames.LIST, sortOptions = false ) -class ListLanguagesSubcommand extends ActCommandProject { +class LanguageListSubcommand extends ActCommandProject { @CommandLine.Option(names = {"--code"}, paramLabel = "...", order = -2) protected BaseCli.LanguageCode code; + @CommandLine.Option(names = {"--all"}, descriptionKey = "crowdin.language.list.all", order = -2) + protected boolean all; + @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") protected boolean plainView; @Override protected NewAction getAction(Actions actions) { - return actions.listLanguages(code, noProgress, plainView); + return actions.listLanguages(code, all, noProgress, plainView); } @Override diff --git a/src/main/java/com/crowdin/cli/commands/picocli/LanguageSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/LanguageSubcommand.java new file mode 100644 index 000000000..f4400c4e4 --- /dev/null +++ b/src/main/java/com/crowdin/cli/commands/picocli/LanguageSubcommand.java @@ -0,0 +1,16 @@ +package com.crowdin.cli.commands.picocli; + +import picocli.CommandLine; + +@CommandLine.Command( + name = CommandNames.LANGUAGE, + subcommands = { + LanguageListSubcommand.class + } +) +class LanguageSubcommand extends HelpCommand { + @Override + protected CommandLine getCommand(CommandLine rootCommand) { + return rootCommand.getSubcommands().get(CommandNames.LANGUAGE); + } +} diff --git a/src/main/java/com/crowdin/cli/commands/picocli/ListSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/ListSubcommand.java index 3f458b76e..033b7bbc8 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/ListSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/ListSubcommand.java @@ -7,8 +7,7 @@ subcommands = { ListProjectSubcommand.class, ListSourcesSubcommand.class, - ListTranslationsSubcommand.class, - ListLanguagesSubcommand.class + ListTranslationsSubcommand.class }) class ListSubcommand extends HelpCommand { @Override diff --git a/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java b/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java index ac43ef92e..015624f6a 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java @@ -24,6 +24,7 @@ ScreenshotSubcommand.class, LabelSubcommand.class, FileSubcommand.class, + LanguageSubcommand.class }) class RootCommand extends HelpCommand { @Override diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index a15cb6834..628b9da2e 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -81,18 +81,13 @@ crowdin.list.sources.usage.description=List information about the source files t crowdin.list.sources.usage.customSynopsis=@|fg(green) crowdin list sources|@ [CONFIG OPTIONS] [OPTIONS] # CROWDIN LIST COMMAND -crowdin.list.usage.description=Show a list of files or target languages +crowdin.list.usage.description=Show a list of files crowdin.list.usage.customSynopsis=@|fg(green) crowdin list|@ [SUBCOMMAND] [CONFIG OPTIONS] [OPTIONS] # CROWDIN LIST TRANSLATIONS COMMAND crowdin.list.translations.usage.description=List information about the translation files that match the wild-card pattern contained in the current project crowdin.list.translations.usage.customSynopsis=@|fg(green) crowdin list translations|@ [CONFIG OPTIONS] [OPTIONS] -#CROWDIN LIST LANGUAGES COMMAND -crowdin.list.languages.usage.description=List target languages in the current project -crowdin.list.languages.usage.customSynopsis=@|fg(green) crowdin list languages|@ [CONFIG OPTIONS] [OPTIONS] -crowdin.list.languages.code=Specify language code. Supported values: id, two_letters_code, three_letters_code, locale, android_code, osx_code, osx_locale. Default: two_letters_code - # CROWDIN COMMAND crowdin.usage.description.0=Crowdin CLI is a command-line tool that allows you to manage and synchronize localization resources with your Crowdin project. crowdin.usage.description.1=Visit the official documentation for more details: https://crowdin.github.io/crowdin-cli @@ -117,6 +112,16 @@ crowdin.upload.translations.auto-approve-imported=Approve added translations aut crowdin.upload.translations.import-eq-suggestions=Add translations even if they're the same as the source strings in your Crowdin project crowdin.upload.translations.translate-hidden=Upload translations to hidden source strings +# CROWDIN LANGUAGE COMMAND +crowdin.language.usage.description=Manage languages in a Crowdin project +crowdin.language.usage.customSynopsis=@|fg(green) crowdin language|@ [SUBCOMMAND] [CONFIG OPTIONS] [OPTIONS] + +# CROWDIN LANGUAGE LIST COMMAND +crowdin.language.list.usage.description=List target languages in the current project +crowdin.language.list.usage.customSynopsis=@|fg(green) crowdin language list|@ [CONFIG OPTIONS] [OPTIONS] +crowdin.language.list.code=Specify language code. Supported values: id, two_letters_code, three_letters_code, locale, android_code, osx_code, osx_locale. Default: two_letters_code +crowdin.language.list.all=To fetch all languages within account + # CROWDIN FILE COMMAND crowdin.file.usage.description=Manage source files and translations in a Crowdin project crowdin.file.usage.customSynopsis=@|fg(green) crowdin file|@ [SUBCOMMAND] [CONFIG OPTIONS] [OPTIONS] @@ -657,7 +662,6 @@ message.target_success=@|fg(green),bold '%s'|@ @|fg(green) target successfully d message.target_deprecated=This command is deprecated. Please use 'crowdin bundle' and 'crowdin download bundle' commands instead message.no_targets_to_exec=Couldn't find any targets to download message.no_target_to_exec=Couldn't find @|bold '%s'|@ target to download -message.description=%s @|bold '%s'|@ message.obsolete_file=Obsolete file @|bold '%s'|@ message.file_id_deprecated=File id is deprecated and will be removed in future releases. Please use file path instead message.file_deleted=File @|bold '%s'|@ deleted @@ -666,7 +670,8 @@ message.no_file_string_project=File management is not available for string-based message.download_sources.preserve_hierarchy_warning=Because the @|bold 'preserve_hierarchy'|@ parameter is set to 'false':\n\t- CLI might download some unexpected files that match the pattern;\n\t- Source file hierarchy may not be preserved and will be the same as in Crowdin. message.download_translations.preserve_hierarchy_warning=Because the @|bold 'preserve_hierarchy'|@ parameter is set to 'false' CLI might download some unexpected files that match the pattern -message.branch.list=@|yellow #%d|@ @|green '%s'|@ +message.language.list=@|yellow %s|@ @|green %s|@ +message.branch.list=@|yellow #%d|@ @|green %s|@ message.source_string_uploaded=Source string was added successfully message.source_string_for_file_uploaded=Source string was added successfully to the file @|bold '%s'|@ @@ -679,12 +684,12 @@ message.source_string_list_max_length=\t- @|bold max-length|@: %s message.source_string_list_not_found=No strings found message.glossary.download_success=@|green,bold '%s'|@ @|green downloaded successfully|@ -message.glossary.list=@|yellow #%d|@ @|bold '%s'|@ (@|green terms: %d|@) +message.glossary.list=@|yellow #%d|@ @|bold %s|@ (@|green terms: %d|@) message.glossary.list_term=\t@|yellow #%d|@ @|cyan '%s'|@: %s message.glossary.import_success=Imported in @|yellow #%s|@ @|green '%s'|@ glossary message.tm.download_success=@|green,bold '%s'|@ @|green downloaded successfully|@ -message.tm.list=@|yellow #%d|@ @|bold '%s'|@ (@|green segments: %d|@) +message.tm.list=@|yellow #%d|@ @|bold %s|@ (@|green segments: %d|@) message.tm.import_success=Imported in @|yellow #%s|@ @|green '%s'|@ translation memory message.tm.list_empty=No translation memories found @@ -693,9 +698,9 @@ message.screenshot.updated=@|green,bold Screenshot '%s'|@ @|green updated succes message.screenshot.deleted=@|green,bold Screenshot '%s'|@ @|green deleted successfully|@ message.screenshot.not_auto-tagged=Tags were not applied for %s because auto tag is currently in progress message.screenshot.list_empty=No screenshot found -message.screenshot.list=@|yellow #%d|@ @|bold '%s'|@ @|green %d tags|@ +message.screenshot.list=@|yellow #%d|@ @|bold %s|@ @|green %d tags|@ -message.task.list=@|yellow #%d|@ @|bold %s|@ @|green '%s'|@ +message.task.list=@|yellow #%d|@ @|bold %s|@ @|green %s|@ message.task.list.verbose=@|yellow #%d|@ @|bold %s|@ @|green '%s'|@ @|bold %s|@ @|yellow %d|@ @|red %s|@ message.task.list_empty=No tasks found message.task.added=@|green,bold Task '%s'|@ @|green added successfully|@ @@ -706,7 +711,7 @@ message.distribution.added=@|green,bold Distribution '%s'|@ @|green added succes message.distribution.released=@|green,bold Distribution '%s'|@ @|green released successfully|@ message.bundle.download_success=@|yellow #%d|@ @|green,bold '%s'|@ @|green downloaded successfully|@ -message.bundle.list=@|yellow #%d|@ @|bold '%s'|@ @|green %s|@ @|red %s|@ +message.bundle.list=@|yellow #%d|@ @|bold %s|@ @|green %s|@ @|red %s|@ message.bundle.list_empty=No bundles found message.bundle.added=@|green,bold Bundle #%s '%s'|@ @|green added successfully|@ diff --git a/src/test/java/com/crowdin/cli/commands/actions/ListLanguagesActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/LanguageListActionTest.java similarity index 80% rename from src/test/java/com/crowdin/cli/commands/actions/ListLanguagesActionTest.java rename to src/test/java/com/crowdin/cli/commands/actions/LanguageListActionTest.java index d186d47bb..f571b0763 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/ListLanguagesActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/LanguageListActionTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.*; -public class ListLanguagesActionTest { +public class LanguageListActionTest { ProjectClient client; CrowdinProjectInfo projectInfo; @@ -45,7 +45,7 @@ public String getValueOrDefault(String languageId, String placeholder, String de @Test public void testActWithNoManagerAccess() { when(projectInfo.isManagerAccess()).thenReturn(false); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.id, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.id, false, false, false); action.act(out, properties, client); verify(out, times(2)).println(anyString()); } @@ -58,7 +58,7 @@ public void testActPrintLanguagesPlainView() { lang.setTwoLettersCode("en"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.id, false, true); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.id, false, false, true); action.act(out, properties, client); verify(out).println("en"); } @@ -69,7 +69,7 @@ public void testActPrintLanguagesWithThreeLettersCode() { lang.setThreeLettersCode("eng"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.three_letters_code, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.three_letters_code, false, false, false); action.act(out, properties, client); verify(out).println(contains("eng")); } @@ -80,7 +80,7 @@ public void testActPrintLanguagesWithAndroidCode() { lang.setAndroidCode("en-rUS"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.android_code, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.android_code, false, false, false); action.act(out, properties, client); verify(out).println(contains("en-rUS")); } @@ -91,7 +91,7 @@ public void testActPrintLanguagesWithOsxCode() { lang.setOsxCode("en"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.osx_code, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.osx_code, false, false, false); action.act(out, properties, client); verify(out).println(contains("en")); } @@ -102,7 +102,7 @@ public void testActPrintLanguagesWithOsxLocale() { lang.setOsxLocale("en_US"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.osx_locale, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.osx_locale, false, false, false); action.act(out, properties, client); verify(out).println(contains("en_US")); } @@ -113,7 +113,7 @@ public void testActPrintLanguagesWithLocale() { lang.setLocale("en_US"); when(projectInfo.getProjectLanguages(true)).thenReturn(Collections.singletonList(lang)); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.locale, false, false); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.locale, false, false, false); action.act(out, properties, client); verify(out).println(contains("en_US")); } @@ -122,7 +122,7 @@ public void testActPrintLanguagesWithLocale() { public void testActWithoutManagerAccessPlainView() { when(projectInfo.isManagerAccess()).thenReturn(false); - ListLanguagesAction action = new ListLanguagesAction(BaseCli.LanguageCode.id, false, true); + LanguageListAction action = new LanguageListAction(BaseCli.LanguageCode.id, false, false, true); assertThrows(RuntimeException.class, () -> action.act(out, properties, client)); } } diff --git a/website/docs/releases/migration-4.md b/website/docs/releases/migration-4.md index ad20427e9..4c85cba8d 100644 --- a/website/docs/releases/migration-4.md +++ b/website/docs/releases/migration-4.md @@ -65,3 +65,18 @@ Before: After: - `crowdin branch list` + +### Language updates + +* removed `crowdin list languages` command +* create new command `crowdin language list` command +* updated `list` cmd output +* added new param `--all` to get all languages for current account + +Before: + +- `crowdin list languages` + +After: + +- `crowdin language list` diff --git a/website/mantemplates/crowdin-list-languages.adoc b/website/mantemplates/crowdin-language-list.adoc similarity index 90% rename from website/mantemplates/crowdin-list-languages.adoc rename to website/mantemplates/crowdin-language-list.adoc index dcf03b68a..dd52787a4 100644 --- a/website/mantemplates/crowdin-list-languages.adoc +++ b/website/mantemplates/crowdin-language-list.adoc @@ -1,7 +1,7 @@ :includedir: ../generated-picocli-docs -:command: crowdin-list-languages +:command: crowdin-language-list -== crowdin list languages +== crowdin language list include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] diff --git a/website/mantemplates/crowdin-language.adoc b/website/mantemplates/crowdin-language.adoc new file mode 100644 index 000000000..7f4b50699 --- /dev/null +++ b/website/mantemplates/crowdin-language.adoc @@ -0,0 +1,16 @@ +:includedir: ../generated-picocli-docs +:command: crowdin-language + +== crowdin language + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] + +include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] diff --git a/website/sidebars.js b/website/sidebars.js index 5799a4e51..b94fc8c3f 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -80,7 +80,6 @@ const sidebars = { collapsible: true, collapsed: true, items: [ - 'commands/crowdin-list-languages', 'commands/crowdin-list-sources', 'commands/crowdin-list-translations', 'commands/crowdin-list-project', @@ -101,6 +100,19 @@ const sidebars = { 'commands/crowdin-branch-delete', ] }, + { + type: 'category', + label: 'crowdin language', + link: { + type: 'doc', + id: 'commands/crowdin-language' + }, + collapsible: true, + collapsed: true, + items: [ + 'commands/crowdin-language-list', + ] + }, { type: 'category', label: 'crowdin status',