From e00119a3d7be80ad411cc5dcb3c4936c7477e707 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Tue, 16 May 2023 16:30:44 +0300 Subject: [PATCH] feat: improve CLI messages --- .../cli/commands/actions/StatusAction.java | 2 +- .../commands/actions/UploadSourcesAction.java | 2 +- .../actions/UploadTranslationsAction.java | 2 +- .../resources/messages/messages.properties | 83 +++++++++---------- 4 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/StatusAction.java b/src/main/java/com/crowdin/cli/commands/actions/StatusAction.java index 3c6fb1c4a..9efff6575 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/StatusAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/StatusAction.java @@ -43,7 +43,7 @@ public void act(Outputter out, ProjectProperties pb, ProjectClient client) { if (languageId != null) { project.findLanguageById(languageId, true) - .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.not_found_language"), languageId))); + .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), languageId))); } List branches = client.listBranches(); Long branchId = (branchName == null) ? null : branches.stream() diff --git a/src/main/java/com/crowdin/cli/commands/actions/UploadSourcesAction.java b/src/main/java/com/crowdin/cli/commands/actions/UploadSourcesAction.java index 10f71f5e4..1ec51020d 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/UploadSourcesAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/UploadSourcesAction.java @@ -304,7 +304,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) { deleteObsoleteProjectFilesSubAction.postAct(); } if (errorsPresented.get()) { - throw new RuntimeException(RESOURCE_BUNDLE.getString("error.errors_presented")); + throw new RuntimeException(RESOURCE_BUNDLE.getString("error.execution_contains_errors")); } } diff --git a/src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java b/src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java index e49445282..5554bcced 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/UploadTranslationsAction.java @@ -86,7 +86,7 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) { List languages = (languageId != null) ? project.findLanguageById(languageId, true) .map(Collections::singletonList) - .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.not_found_language"), languageId))) + .orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), languageId))) : project.getProjectLanguages(false); for (FileBean file : pb.getFiles()) { diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 3eae46cda..50180d271 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -6,17 +6,17 @@ usage.parameterListHeading=%n@|underline,fg(yellow) PARAMETERS|@:%n usage.optionListHeading=%n@|underline,fg(yellow) OPTIONS|@:%n usage.commandListHeading=%n@|underline,fg(yellow) COMMANDS|@:%n -version=Print version information and exit -help=Show this help message and exit +version=Display version information and exit +help=Display help message and exit no-progress=Disable progress on executed command no-colors=Disable colors and styles -verbose=Provide more information on the command execution +verbose=Provide more information about the command execution params.heading=%n@|underline,fg(yellow) CONFIG OPTIONS|@:%n identity=Specify a path to user-specific credentials config=Specify a path to the configuration file. Default: crowdin.yml or crowdin.yaml -params.project-id=Numerical ID of the project +params.project-id=Numeric ID of the project params.token=Personal access token required for authentication params.base-url=Base URL of Crowdin server for API requests execution params.base-path=Path to your project directory on a local machine @@ -38,15 +38,15 @@ tree=List contents of directories in a tree-like format tree.dryrun=List contents of directories in a tree-like format in dryrun mode # CROWDIN DOWNLOAD COMMAND -crowdin.download.usage.description=Download latest translations from Crowdin to the specified place +crowdin.download.usage.description=Download the latest translations from Crowdin to the specified place crowdin.download.usage.customSynopsis=@|fg(green) crowdin |@(@|fg(green) download|@|@|fg(green) pull|@) [CONFIG OPTIONS] [OPTIONS] crowdin.download.ignore-match=Ignore warning message about a configuration change crowdin.download.language=Use this option to download translations for a single specified language. Default: all crowdin.download.pseudo=Download pseudo-localized translation files -crowdin.download.all=Download files even if local sources are absent +crowdin.download.all=Download files even if local sources are missing # CROWDIN DOWNLOAD TARGETS COMMAND -crowdin.download.targets.usage.description=Download latest translation from Crowdin to the specified target file +crowdin.download.targets.usage.description=Download the latest translation from Crowdin to the specified target file crowdin.download.targets.usage.customSynopsis=@|fg(green) crowdin |@(@|fg(green) download|@|@|fg(green) pull|@) @|fg(green) targets|@ [CONFIG OPTIONS] [OPTIONS] crowdin.download.targets.targetNames=Specify the targets that should be downloaded. Default: all crowdin.download.targets.language=Use this option to download translations for a single specified language. Default: all @@ -65,7 +65,7 @@ crowdin.generate.usage.customSynopsis=@|fg(green) crowdin |@(@|fg(green) generat crowdin.generate.destination=Place where the configuration skeleton should be saved. Default: ${DEFAULT-VALUE} # CROWDIN LINT COMMAND -crowdin.lint.usage.description=Analyze your configuration file for potential errors +crowdin.lint.usage.description=Analyze your configuration file for possible errors crowdin.lint.usage.customSynopsis=@|fg(green) crowdin lint|@ [CONFIG OPTIONS] [OPTIONS] # CROWDIN LIST COMMAND @@ -98,7 +98,7 @@ crowdin.list.languages.code=Specify language code. Available values: id, two_let # 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=This tool requires you to create a configuration file. For more details see https://support.crowdin.com/configuration-file/ +crowdin.usage.description.1=This tool requires you to create a configuration file. For more details see https://developer.crowdin.com/configuration-file crowdin.usage.customSynopsis=@|fg(green) crowdin|@ [SUBCOMMAND] [OPTIONS] # CROWDIN UPLOAD SOURCES COMMAND @@ -247,7 +247,7 @@ crowdin.tm.download.target-language-id=Defines target language in the language p crowdin.tm.download.to=Path the translation memory should be downloaded to # CROWDIN BUNDLE DOWNLOAD COMMAND -crowdin.bundle.download.id=Bundle identifier +crowdin.bundle.download.id=Numeric ID of the bundle # CROWDIN TASK COMMAND crowdin.task.usage.description=Manage tasks in a Crowdin Project @@ -303,8 +303,6 @@ crowdin.pre-translate.translate-untranslated-only=Applies pre-translation for un crowdin.pre-translate.translate-with-perfect-match-only=Applies pre-translation only for the strings with perfect match error.collect_project_info=Failed to collect project info. Please contact our support team for help -error.create_branch=Failed to create the branch '%s'. Please contact our support team for help -error.no_sources_or_translations=No source and/or translation paths are specified in the configuration file error.no_sources=No sources found for '%s' pattern. Check the source paths in your configuration file error.only_enterprise=Operation is available only for Crowdin Enterprise error.cast_param='%s' parameter contains an unexpected value type @@ -327,37 +325,33 @@ error.create_file=Failed to create the configuration file. Try to run the applic error.write_file=Failed to write to the file '%s'. Try to run the application with admin permission error.export_strings_that_passed_workflow_not_supported = Exporting strings that passed workflow is supported only for Crowdin Enterprise error.read_resource_file=Couldn't read from the file '%s'. Try to run the application with admin permission -error.not_found_branch=Branch with the specified name doesn't exist in the project. Try specifying another branch name -error.not_found_language=Language '%s' doesn't exist in the project. Try specifying another language code +error.not_found_branch=The branch with the specified name doesn't exist in the project. Try specifying another branch name error.source_not_exists_in_project=Failed to upload translations for the source '%s' since file '%s' is missing in the project. Run the 'crowdin push' to upload the missing source error.translation_not_exists='%s' translation file doesn't exist in the specified place error.upload_translation_to_storage=Failed to upload the translation file to the storage. Please contact our support team for help error.upload_translation=Failed to upload the translation file. Please contact our support team for help error.configuration_file_is_invalid=Configuration file is invalid. Check the following parameters in your configuration file: error.configuration_is_invalid=Configuration is invalid. Check the following parameters: -error.params_are_invalid=Some of the command options are invalid. Check the following parameters: +error.params_are_invalid=Some command options are invalid. Check the following parameters: error.empty_properties_file=Configuration file is empty. Fill it out accordingly to the following requirements: \ -https://support.crowdin.com/configuration-file/#configuration-file-structure +https://developer.crowdin.com/configuration-file/#configuration-file-structure error.configuration_file_not_exist=Configuration file doesn't exist. Run the 'crowdin init' to generate configuration skeleton error.identity_file_not_exist=Identity file '%s' doesn't exist error.reading_configuration_file=Failed to read the configuration file. Try to run the application with admin permission error.deleting_archive=Failed to delete the archive '%s' with downloaded files -error.clearing_temp=Failed to clear temporary files -error.while_checking_base_path=Failed to check base path. Try to run the application with admin permission -error.skip_untranslated_both_strings_and_files=Sorry, you cannot skip strings and files simultaneously. Please use one of these parameters instead. -error.file_not_exists=Project doesn't contain the file '%s' +error.clearing_temp=Failed to delete temporary files +error.while_checking_base_path=Failed to check the base path. Try to run the application with admin permission +error.skip_untranslated_both_strings_and_files=You cannot skip strings and files at the same time. Please use one of these parameters instead. +error.file_not_exists=Project doesn't contain the '%s' file error.dir_not_exists=Project doesn't contain the '%s' directory error.label_not_exists=Project doesn't contain the '%s' label error.branch_not_exists=Project doesn't contain the '%s' branch -error.identifier_option_required=Required option '--identifier' is missing in the command -error.file_option_required=Required option '--file' is missing in the command error.source_string_not_found=No strings found by the specified identifier error.source_string_id_not_specified=No identifiers specified error.source_string_no_edit=Specify some parameters to edit the string error.unexpected_response=Unexpected response from %s: %s error.error_response=Error from %s: %s error.in_local_server=Error in raised local server -error.errors_presented=Current execution finished with errors error.execution_contains_errors=Current execution finished with errors error.target_has_list_of_errors=Configuration file contains errors in the '%s' target error.crowdin_not_support_file_format='%s' file format is not supported for target @@ -378,7 +372,7 @@ error.glossary.no_id_and_no_name='--id' or '--name' should be specified to ident error.glossary.scheme_and_wrong_format=Scheme is used only for CSV or XLS/XLSX files error.glossary.scheme_is_required=Scheme is required for CSV or XLS/XLSX files error.glossary.first_line_contains_header_and_wrong_format='--first-line-contains-header' is used only for CSV or XLS/XLSX files -error.glossary.no_permission=You do not have permission to this glossary. +error.glossary.no_permission=You do not have permission to manage this glossary error.glossary.no_language_id='--language' is required for creating new glossary error.tm.build_tm=Failed to build the translation memory @@ -412,44 +406,43 @@ error.bundle.empty_translation='--translation' can't be empty error.bundle.build_bundle=Failed to build the bundle error.bundle.not_found_by_id=Couldn't find bundle by the specified ID -error.pre_translate.engine_id=Machine Translation should be used with 'engineId' parameter -error.pre_translate.duplicate_translations='--duplicate-translations' works only with TM pre-translation method -error.pre_translate.translate_untranslated_only='--translate-untranslated-only' works only with TM pre-translation method -error.pre_translate.translate_with_perfect_match_only='--translate-with-perfect-match-only' works only with TM pre-translation method +error.pre_translate.engine_id=Machine Translation should be used with the '--engine-id' parameter +error.pre_translate.duplicate_translations='--duplicate-translations' only works with the TM pre-translation method +error.pre_translate.translate_untranslated_only='--translate-untranslated-only' only works with the TM pre-translation method +error.pre_translate.translate_with_perfect_match_only='--translate-with-perfect-match-only' only works with the TM pre-translation method error.pre_translate.auto_approve_option=Wrong '--auto-approve-option' parameter. Available values: 'all', 'except-auto-substituted', 'perfect-match-only', 'none' -error.response.401=Couldn't authorize. Check your 'api_token'. -error.response.403=You do not have permission to view/edit project with provided id. -error.response.403_upgrade_subscription=Please, upgrade your subscription plan to upload more file formats. -error.response.404_project_not_found=Project with provided id doesn't exist. +error.response.401=Couldn't authorize. Check your 'api_token' +error.response.403=You do not have permission to view/edit project with provided id +error.response.403_upgrade_subscription=Please, upgrade your subscription plan to upload more file formats +error.response.404_project_not_found=Project with provided id doesn't exist error.response.404_organization_not_found=No organization is located at this url. Check your 'base_url' error.response.url_not_known=Invalid url. check your 'base_url' error.response.certificate=Java unable to find valid certification path to api.crowdin.com. This error usually occurs due to the enabled firewall. To fix this problem you need to add certificate from crowdin.com and add it to your java cacerts file. More detailed description can be found here: https://magicmonster.com/kb/prg/java/ssl/pkix_path_building_failed/. Or you can search other articles on this issue for these keywords: "unable to find valid certification path to requested target", "PKIX path building failed". error.config.property_bean_null=Failed to read the parameters stored in the configuration file. Please contact our support team for help error.config.missed_project_id=Required option 'project_id' is missing -error.config.project_id_is_not_number=Option 'project_id' must be a numerical value +error.config.project_id_is_not_number=Option 'project_id' must be a numeric value error.config.missed_api_token=Required option 'api_token' is missing error.config.missed_base_url=Required option 'base_url' is missing -error.config.wrong_base_url=Unexpected 'base_url'. The expected format is 'https://crowdin.com' or 'https://{domain_name}.crowdin.com' -error.config.base_path_is_not_dir=Base path '%s' should be a directory. Specify the path to your project directory -error.config.base_path_not_exist=Base path %s was not found. Check your 'base_path' for potential typos and/or capitalization mismatches +error.config.wrong_base_url=Unexpected 'base_url'. The expected format is 'https://api.crowdin.com' or 'https://{domain_name}.api.crowdin.com' +error.config.base_path_is_not_dir=The base path '%s' should be a directory. Specify the path to your project directory +error.config.base_path_not_exist=The base path %s was not found. Check your 'base_path' for possible typos and/or capitalization mismatches error.config.base_path_empty='base_path' in your configuration file is empty. Specify your 'base_path' and try again error.config.empty_or_missed_section_files=Required section 'files' is missing (or empty) in the configuration file error.config.empty_or_missed_section_targets=Required section 'targets' is missing (or empty) in the configuration file -error.config.empty_source_section='Source' parameter couldn't be empty. Specify source paths in your configuration file -error.config.empty_translation_section='Translation' parameter couldn't be empty. Specify translation paths in your configuration file +error.config.empty_source_section=The 'source' parameter can't be empty. Specify the source paths in your configuration file +error.config.empty_translation_section=The 'translation' parameter can't be empty. Specify the translation paths in your configuration file error.config.double_asterisk=The mask '**' can be used in the 'translation' pattern only if it's used in the 'source' pattern -error.config.translation_has_no_language_placeholders='Translation' parameter should contain at least one language placeholder (e.g. %locale%) -error.config.translation_contains_relative_paths='Translation' parameter can't contain any relative paths '../' or './' +error.config.translation_has_no_language_placeholders=The 'translation' parameter should contain at least one language placeholder (e.g. %locale%) +error.config.translation_contains_relative_paths=The 'translation' parameter can't contain any relative paths '../' or './' error.config.update_option=Configuration file contains unexpected 'update_option' value. The expected values are 'update_as_unapproved' or 'update_without_changes' -error.config.escape_quotes=Acceptable values for 'escape_quotes' are: 0, 1, 2, 3. Default is 3. Read more about 'escape_quotes': https://support.crowdin.com/configuration-file/#escape-quotes-options-for-properties-file-format -error.config.escape_special_characters=Acceptable values for 'escape_special_characters' are: 0 and 1. Default is 1. Read more about 'escape_special_characters': https://support.crowdin.com/configuration-file/#escape-quotes-options-for-properties-file-format -error.config.params_xor_source_translation=Both the 'source' and the 'translation' must be specified in parameters +error.config.escape_quotes=Acceptable values for 'escape_quotes' are: 0, 1, 2, 3. Default is 3. Read more about 'escape_quotes': https://developer.crowdin.com/configuration-file/#escape-quotes-options-for-properties-file-format +error.config.escape_special_characters=Acceptable values for 'escape_special_characters' are: 0 and 1. Default is 1. Read more about 'escape_special_characters': https://developer.crowdin.com/configuration-file/#escape-quotes-options-for-properties-file-format +error.config.params_xor_source_translation=Both the 'source' and the 'translation' must be specified in the parameters error.config.params_dest='dest' must be specified with both 'source' and 'translation' parameters error.config.target_has_no_name=Required target 'name' field is missing in the configuration file error.config.target_has_more_than_one_type_of_sources=Target %s contains more than one type of sources. Use only one of the following types: 'sources', 'directories' or 'branches' -error.config.length_correction_boundaries=Acceptable value for 'length_correction' is from -50 to 100 error.config.enum_class_exception=Configuration file contains unexpected '%s' value type. The expected value is: %s error.config.enum_wrong_value=Configuration file contains unexpected '%s' value. The expected values are: %s error.config.pseudo_localization_length_correction_out_of_bounds=Acceptable value for 'length_correction' is from -50 to 100 @@ -486,7 +479,7 @@ message.item_list_with_count=\t- %s (%d) message.item_list_with_percents=\t- %s: %d%% message.command_generate_description=Generating Crowdin CLI configuration skeleton @|bold '%s'|@ message.already_exists=File @|bold '%s'|@ already exists. Fill it out accordingly to the following requirements: \ -@|cyan https://support.crowdin.com/configuration-file/#configuration-file-structure|@ +@|cyan https://developer.crowdin.com/configuration-file/#configuration-file-structure|@ message.generate_successful=%nYour configuration skeleton has been successfully generated. \ %nSpecify your source and translation paths in the files section. \ %nFor more details see @|cyan %s|@