diff --git a/scripts/install-crowdin-cli.sh b/scripts/install-crowdin-cli.sh index 54e477f1b..d18a0df1b 100755 --- a/scripts/install-crowdin-cli.sh +++ b/scripts/install-crowdin-cli.sh @@ -3,7 +3,7 @@ if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi echo "Checking JAVA installation..." -copySuccessed=1 +copySucceeded=1 if type -p java; then _java=java @@ -25,7 +25,7 @@ if [[ "$_java" ]]; then cp crowdin-cli.jar /usr/local/bin - copySuccessed=$? + copySucceeded=$? [ -d "/etc/bash_completion.d" ] && cp crowdin_completion /etc/bash_completion.d/crowdin_completion [ -d "/usr/local/etc/bash_completion.d" ] && cp crowdin_completion /usr/local/etc/bash_completion.d/crowdin_completion @@ -53,7 +53,7 @@ EOF" fi fi -if [ $copySuccessed -ne 0 ]; then +if [ $copySucceeded -ne 0 ]; then echo "Crowdin CLI not installed!" else echo "Crowdin CLI installed!" diff --git a/src/main/java/com/crowdin/cli/commands/actions/GenerateAction.java b/src/main/java/com/crowdin/cli/commands/actions/GenerateAction.java index 8312cff9d..73865f18d 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/GenerateAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/GenerateAction.java @@ -115,7 +115,7 @@ private void updateWithUserInputs(Outputter out, Asking asking, List fil if (StringUtils.isNotEmpty(organizationName)) { if (PropertiesBeanUtils.isUrlValid(organizationName)) { String realOrganizationName = PropertiesBeanUtils.getOrganization(organizationName); - System.out.println(String.format(RESOURCE_BUNDLE.getString("message.exctracted_organization_name"), realOrganizationName)); + System.out.println(String.format(RESOURCE_BUNDLE.getString("message.extracted_organization_name"), realOrganizationName)); values.put(BASE_URL, String.format(BASE_ENTERPRISE_URL_DEFAULT, realOrganizationName)); } else { values.put(BASE_URL, String.format(BASE_ENTERPRISE_URL_DEFAULT, PropertiesBeanUtils.getOrganization(organizationName))); diff --git a/src/main/java/com/crowdin/cli/commands/functionality/SourcesUtils.java b/src/main/java/com/crowdin/cli/commands/functionality/SourcesUtils.java index 694e038bb..728f0c15c 100644 --- a/src/main/java/com/crowdin/cli/commands/functionality/SourcesUtils.java +++ b/src/main/java/com/crowdin/cli/commands/functionality/SourcesUtils.java @@ -26,8 +26,8 @@ public class SourcesUtils { private static final String QUESTION_MARK = "?"; private static final String DOT = "."; private static final String DOT_PLUS = ".+"; - private static final String SET_OPEN_BRECKET = "["; - private static final String SET_CLOSE_BRECKET = "]"; + private static final String SET_OPEN_BRACKET = "["; + private static final String SET_CLOSE_BRACKET = "]"; private static final String ROUND_BRACKET_OPEN = "("; private static final String ROUND_BRACKET_CLOSE = ")"; private static final String ESCAPE_ROUND_BRACKET_OPEN = "\\("; diff --git a/src/main/java/com/crowdin/cli/commands/picocli/PreTranslateSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/PreTranslateSubcommand.java index 1993dd858..d1200020e 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/PreTranslateSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/PreTranslateSubcommand.java @@ -79,7 +79,7 @@ protected List checkOptions() { errors.add(RESOURCE_BUNDLE.getString("error.pre_translate.translate_untranslated_only")); } if ((Method.MT == method) && translateWithPerfectMatchOnly != null) { - errors.add(RESOURCE_BUNDLE.getString("error.pre_tranlsate.translate_with_perfect_match_only")); + errors.add(RESOURCE_BUNDLE.getString("error.pre_translate.translate_with_perfect_match_only")); } if (Method.MT == method && autoApproveOption != null) { System.out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.warning.auto_approve_option_with_mt"))); diff --git a/src/main/java/com/crowdin/cli/commands/picocli/TmDownloadSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/TmDownloadSubcommand.java index d21fcdd83..e24c9a440 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/TmDownloadSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/TmDownloadSubcommand.java @@ -28,7 +28,7 @@ class TmDownloadSubcommand extends ActCommandTm { private String sourceLanguageId; @CommandLine.Option(names = {"--target-language-id"}, paramLabel = "...") - private String targetLanguageid; + private String targetLanguageId; @CommandLine.Option(names = {"--format"}, paramLabel = "...") private TranslationMemoryFormat format; @@ -38,7 +38,7 @@ class TmDownloadSubcommand extends ActCommandTm { @Override protected NewAction getAction(Actions actions) { - return actions.tmDownload(id, name, format, sourceLanguageId, targetLanguageid, noProgress, to, new FsFiles()); + return actions.tmDownload(id, name, format, sourceLanguageId, targetLanguageId, noProgress, to, new FsFiles()); } @Override @@ -57,9 +57,9 @@ protected List checkOptions() { } else if (id == null && name == null) { errors.add(RESOURCE_BUNDLE.getString("error.tm.no_id_and_no_name")); } - if (sourceLanguageId != null && targetLanguageid == null) { + if (sourceLanguageId != null && targetLanguageId == null) { errors.add(RESOURCE_BUNDLE.getString("error.tm.target_language_id_is_null")); - } else if (sourceLanguageId == null && targetLanguageid != null) { + } else if (sourceLanguageId == null && targetLanguageId != null) { errors.add(RESOURCE_BUNDLE.getString("error.tm.source_language_id_is_null")); } return errors; diff --git a/src/main/java/com/crowdin/cli/properties/FileBean.java b/src/main/java/com/crowdin/cli/properties/FileBean.java index 08bd7ec29..1dadac3ce 100755 --- a/src/main/java/com/crowdin/cli/properties/FileBean.java +++ b/src/main/java/com/crowdin/cli/properties/FileBean.java @@ -209,7 +209,7 @@ private static boolean checkDest(String dest, String source) { boolean destContainsPlaceholders = dest.contains(PlaceholderUtil.PLACEHOLDER_FILE_NAME) || dest.contains(PlaceholderUtil.PLACEHOLDER_ORIGINAL_FILE_NAME) || dest.contains(PlaceholderUtil.PLACEHOLDER_ORIGINAL_PATH) - || dest.contains(PlaceholderUtil.PLACEHOLDER_FILE_EXTENTION) + || dest.contains(PlaceholderUtil.PLACEHOLDER_FILE_EXTENSION) || dest.contains(PlaceholderUtil.DOUBLED_ASTERISK); boolean sourceContainsPlaceholders = PlaceholderUtil.containsFilePlaceholders(source) || SourcesUtils.containsPattern(source); return !sourceContainsPlaceholders || destContainsPlaceholders; diff --git a/src/main/java/com/crowdin/cli/properties/helper/FileHelper.java b/src/main/java/com/crowdin/cli/properties/helper/FileHelper.java index a767724c8..2282a9875 100755 --- a/src/main/java/com/crowdin/cli/properties/helper/FileHelper.java +++ b/src/main/java/com/crowdin/cli/properties/helper/FileHelper.java @@ -29,9 +29,9 @@ public class FileHelper { private static final String DOT_PLUS = ".+"; - private static final String SET_OPEN_BRECKET = "["; + private static final String SET_OPEN_BRACKET = "["; - private static final String SET_CLOSE_BRECKET = "]"; + private static final String SET_CLOSE_BRACKET = "]"; private static final String ROUND_BRACKET_OPEN = "("; @@ -96,7 +96,7 @@ public List getFiles(String source) { * * @param sources the source files. * @param ignores the configured filters. - * @return the list of source files withoug the ignores. + * @return the list of source files without the ignores. */ public List filterOutIgnoredFiles(List sources, List ignores) { if (sources == null || ignores == null) { diff --git a/src/main/java/com/crowdin/cli/utils/PlaceholderUtil.java b/src/main/java/com/crowdin/cli/utils/PlaceholderUtil.java index 5eba5de42..624aa729d 100644 --- a/src/main/java/com/crowdin/cli/utils/PlaceholderUtil.java +++ b/src/main/java/com/crowdin/cli/utils/PlaceholderUtil.java @@ -35,7 +35,7 @@ public class PlaceholderUtil { public static final String PLACEHOLDER_NAME_OSX_LOCALE = "osx_locale"; public static final String PLACEHOLDER_NAME_LANGUAGE_ID = "language_id"; - public static final String PLACEHOLDER_FILE_EXTENTION = "%file_extension%"; + public static final String PLACEHOLDER_FILE_EXTENSION = "%file_extension%"; public static final String PLACEHOLDER_FILE_NAME = "%file_name%"; public static final String PLACEHOLDER_ORIGINAL_FILE_NAME = "%original_file_name%"; public static final String PLACEHOLDER_ORIGINAL_PATH = "%original_path%"; @@ -47,8 +47,8 @@ public class PlaceholderUtil { private static final String QUESTION_MARK = "?"; private static final String DOT = "."; private static final String DOT_PLUS = ".+"; - private static final String SET_OPEN_BRECKET = "["; - private static final String SET_CLOSE_BRECKET = "]"; + private static final String SET_OPEN_BRACKET = "["; + private static final String SET_CLOSE_BRACKET = "]"; public static final String ROUND_BRACKET_OPEN = "("; public static final String ROUND_BRACKET_CLOSE = ")"; public static final String ESCAPE_ROUND_BRACKET_OPEN = "\\("; @@ -68,7 +68,7 @@ public class PlaceholderUtil { public PlaceholderUtil(List supportedLangs, List projectLangs, String basePath) { if (supportedLangs == null || projectLangs == null || basePath == null) { - throw new NullPointerException("in PlaceholderUtil.contructor"); + throw new NullPointerException("in PlaceholderUtil.constructor"); } this.supportedLangs = supportedLangs; this.projectLangs = projectLangs; @@ -182,7 +182,7 @@ public String replaceFileDependentPlaceholders(String toFormat, File file) { toFormat = toFormat.contains(PLACEHOLDER_ORIGINAL_FILE_NAME) ? toFormat.replace(PLACEHOLDER_ORIGINAL_FILE_NAME, fileName) : toFormat; toFormat = toFormat.contains(PLACEHOLDER_FILE_NAME) ? toFormat.replace(PLACEHOLDER_FILE_NAME, fileNameWithoutExt) : toFormat; - toFormat = toFormat.contains(PLACEHOLDER_FILE_EXTENTION) ? toFormat.replace(PLACEHOLDER_FILE_EXTENTION, fileExt) : toFormat; + toFormat = toFormat.contains(PLACEHOLDER_FILE_EXTENSION) ? toFormat.replace(PLACEHOLDER_FILE_EXTENSION, fileExt) : toFormat; toFormat = toFormat.contains(PLACEHOLDER_ORIGINAL_PATH) ? toFormat.replace(PLACEHOLDER_ORIGINAL_PATH, fileParent) : toFormat; if (toFormat.contains("**")) { @@ -255,7 +255,7 @@ public static String formatSourcePatternForRegex(String toFormat) { .replace(ESCAPE_ASTERISK_REPLACEMENT_FROM, ESCAPE_ASTERISK_REPLACEMENT_TO); return toFormat - .replace(PLACEHOLDER_FILE_EXTENTION, "[^/]+") + .replace(PLACEHOLDER_FILE_EXTENSION, "[^/]+") .replace(PLACEHOLDER_FILE_NAME, "[^/]+") .replace(PLACEHOLDER_ORIGINAL_FILE_NAME, "[^/]+") .replace(PLACEHOLDER_ORIGINAL_PATH, ".+"); @@ -263,7 +263,7 @@ public static String formatSourcePatternForRegex(String toFormat) { public static boolean containsFilePlaceholders(String pattern) { return StringUtils.containsAny(pattern, - PLACEHOLDER_FILE_EXTENTION, + PLACEHOLDER_FILE_EXTENSION, PLACEHOLDER_FILE_NAME, PLACEHOLDER_ORIGINAL_FILE_NAME, PLACEHOLDER_ORIGINAL_PATH); diff --git a/src/main/java/com/crowdin/cli/utils/Utils.java b/src/main/java/com/crowdin/cli/utils/Utils.java index b633538fa..3fb66fba9 100755 --- a/src/main/java/com/crowdin/cli/utils/Utils.java +++ b/src/main/java/com/crowdin/cli/utils/Utils.java @@ -124,8 +124,8 @@ public static String regexPath(String path) { } } - public static String joinPaths(String... pathes) { - return String.join(Utils.PATH_SEPARATOR, pathes).replaceAll("[\\\\/]+", Utils.PATH_SEPARATOR_REGEX); + public static String joinPaths(String... paths) { + return String.join(Utils.PATH_SEPARATOR, paths).replaceAll("[\\\\/]+", Utils.PATH_SEPARATOR_REGEX); } public static String[] splitPath(String path) { diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 80b928685..4d0149b8c 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -168,7 +168,7 @@ crowdin.string.delete.usage.description=Delete source string crowdin.string.delete.usage.customSynopsis=@|fg(green) crowdin string delete|@ [CONFIG OPTIONS] [OPTIONS] crowdin.string.delete.id=Numeric string identifier (multiple ids could be specified) crowdin.string.delete.text=Use text as string identifier (several texts can be specified) -crowdin.string.delete.identifier=String identifier identifier (several identifiers can be specified) +crowdin.string.delete.identifier=String identifier (several identifiers can be specified) # CROWDIN GLOSSARY COMMAND crowdin.glossary.usage.description=Manage glossaries @@ -345,7 +345,7 @@ error.tm.no_language_id='--language' is required for creating new translation me 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_tranlsate.translate_with_perfect_match_only='--translate-with-perfect-match-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.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'. @@ -434,7 +434,7 @@ message.language=@|yellow %s|@(@|yellow %s|@): message.translation_progress=\tTranslated: @|bold %d%%|@ (Words: @|bold %d/%d|@, Phrases: @|bold %d/%d|@) message.approval_progress=\tApproved: @|bold %d%%|@ (Words: @|bold %d/%d|@, Phrases: @|bold %d/%d|@) message.already_uploaded=Skipping file @|bold '%s'|@ because it is already uploading/uploaded -message.exctracted_organization_name=Extracted organization name from provided url: %s +message.extracted_organization_name=Extracted organization name from provided url: %s message.target_success=@|fg(green),bold '%s'|@ @|fg(green) target successfully downloaded|@ @|fg(green) for|@ @|fg(green),bold %s|@ @|fg(green) language|@ 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 diff --git a/src/test/java/com/crowdin/cli/commands/actions/GenerateActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/GenerateActionTest.java index ea521b62c..271e1011a 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/GenerateActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/GenerateActionTest.java @@ -83,7 +83,7 @@ public void enterprisetest() throws IOException { } @Test - public void enterpriseUrltest() throws IOException { + public void enterpriseUrlTest() throws IOException { FilesInterface files = mock(FilesInterface.class); doThrow(new IOException()).when(files).writeToFile(anyString(), any()); InputStream responsesIS = setResponses(false, true, "https://undefined.crowdin.com", "apiToken", "42", "."); diff --git a/src/test/java/com/crowdin/cli/commands/actions/StringAddActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/StringAddActionTest.java index dab86fd00..f1ba8f845 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/StringAddActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/StringAddActionTest.java @@ -93,7 +93,7 @@ public static Stream testStringAdd() { } @Test - public void testStirngAdd_throwsNotFound() { + public void testStringAdd_throwsNotFound() { String text = "first text"; String identifier = "1.1"; Integer maxLength = 42; diff --git a/src/test/java/com/crowdin/cli/commands/actions/StringListActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/StringListActionTest.java index 15dd56edf..06ce18cc9 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/StringListActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/StringListActionTest.java @@ -94,7 +94,7 @@ public void testFileNotExistThrows() throws ResponseException { .thenReturn(ProjectBuilder.emptyProject(Long.parseLong(pb.getProjectId())) .addFile("first.csv", "csv", 101L, null, null).build()); - action = new StringListAction(true, true, "notexist.csv", null, null, null); + action = new StringListAction(true, true, "nonexistent.csv", null, null, null); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); verify(client).downloadFullProject(); diff --git a/src/test/java/com/crowdin/cli/commands/picocli/PicocliRunnerTest.java b/src/test/java/com/crowdin/cli/commands/picocli/PicocliRunnerTest.java index 3d02b2c94..c96c8fe2d 100644 --- a/src/test/java/com/crowdin/cli/commands/picocli/PicocliRunnerTest.java +++ b/src/test/java/com/crowdin/cli/commands/picocli/PicocliRunnerTest.java @@ -14,11 +14,11 @@ public class PicocliRunnerTest extends PicocliTestUtils { public void testHasMatchedArgs() { PicocliRunner picocliRunner = PicocliRunner.getInstance(); assertFalse(picocliRunner.hasMatchedArg("plain")); - picocliRunner.execute(actionsMock, properitesBuildersMock, CommandNames.DOWNLOAD, "--plain"); + picocliRunner.execute(actionsMock, propertiesBuildersMock, CommandNames.DOWNLOAD, "--plain"); assertTrue(picocliRunner.hasMatchedArg("plain")); - picocliRunner.execute(actionsMock, properitesBuildersMock, CommandNames.DOWNLOAD); + picocliRunner.execute(actionsMock, propertiesBuildersMock, CommandNames.DOWNLOAD); assertFalse(picocliRunner.hasMatchedArg("plain")); - picocliRunner.execute(actionsMock, properitesBuildersMock, "--verbose"); + picocliRunner.execute(actionsMock, propertiesBuildersMock, "--verbose"); assertTrue(picocliRunner.hasMatchedArg("verbose")); } diff --git a/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java b/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java index 47962baf2..4924b2b55 100644 --- a/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java +++ b/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java @@ -23,7 +23,7 @@ public class PicocliTestUtils { protected Actions actionsMock; protected NewAction actionMock; - protected PropertiesBuilders properitesBuildersMock; + protected PropertiesBuilders propertiesBuildersMock; @BeforeEach public void beforeEach() { @@ -32,18 +32,18 @@ public void beforeEach() { } public void execute(String... args) { - int exitCode = PicocliRunner.getInstance().execute(actionsMock, properitesBuildersMock, args); + int exitCode = PicocliRunner.getInstance().execute(actionsMock, propertiesBuildersMock, args); assertEquals(0, exitCode); } public void executeInvalidParams(String... args) { - int exitCode = PicocliRunner.getInstance().execute(actionsMock, properitesBuildersMock, args); + int exitCode = PicocliRunner.getInstance().execute(actionsMock, propertiesBuildersMock, args); assertNotEquals(0, exitCode); verifyNoMoreInteractions(actionsMock); } public void executeHelp(String... args) { - int exitCode = PicocliRunner.getInstance().execute(actionsMock, properitesBuildersMock, args); + int exitCode = PicocliRunner.getInstance().execute(actionsMock, propertiesBuildersMock, args); assertEquals(0, exitCode); verifyNoMoreInteractions(actionsMock); } @@ -102,16 +102,16 @@ void mockActions() { } private void mockBuilders() { - properitesBuildersMock = mock(PropertiesBuilders.class); - when(properitesBuildersMock.buildBaseProperties(any(), any(), any(), any())) + propertiesBuildersMock = mock(PropertiesBuilders.class); + when(propertiesBuildersMock.buildBaseProperties(any(), any(), any(), any())) .thenReturn(NewBasePropertiesUtilBuilder.minimalBuilt().build()); - when(properitesBuildersMock.buildNoProperties()) + when(propertiesBuildersMock.buildNoProperties()) .thenReturn(new NoProperties()); - when(properitesBuildersMock.buildPropertiesWithFiles(any(), any(), any(), any())) + when(propertiesBuildersMock.buildPropertiesWithFiles(any(), any(), any(), any())) .thenReturn(NewPropertiesWithFilesUtilBuilder.minimalBuiltPropertiesBean().build()); - when(properitesBuildersMock.buildPropertiesWithTargets(any(), any(), any(), any())) + when(propertiesBuildersMock.buildPropertiesWithTargets(any(), any(), any(), any())) .thenReturn(NewPropertiesWithTargetsUtilBuilder.minimalBuilt().build()); - when(properitesBuildersMock.buildProjectProperties(any(), any(), any(), any())) + when(propertiesBuildersMock.buildProjectProperties(any(), any(), any(), any())) .thenReturn(NewProjectPropertiesUtilBuilder.minimalBuilt().build()); } }