Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spelling #499

Merged
merged 14 commits into from
Nov 4, 2022
Merged
6 changes: 3 additions & 3 deletions scripts/install-crowdin-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private void updateWithUserInputs(Outputter out, Asking asking, List<String> 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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "\\(";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected List<String> 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")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +38,7 @@ class TmDownloadSubcommand extends ActCommandTm {

@Override
protected NewAction<BaseProperties, ClientTm> 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
Expand All @@ -57,9 +57,9 @@ protected List<String> 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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/crowdin/cli/properties/FileBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "(";

Expand Down Expand Up @@ -96,7 +96,7 @@ public List<File> 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<File> filterOutIgnoredFiles(List<File> sources, List<String> ignores) {
if (sources == null || ignores == null) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/crowdin/cli/utils/PlaceholderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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%";
Expand All @@ -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 = "\\(";
Expand All @@ -68,7 +68,7 @@ public class PlaceholderUtil {

public PlaceholderUtil(List<Language> supportedLangs, List<com.crowdin.client.languages.model.Language> 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;
Expand Down Expand Up @@ -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("**")) {
Expand Down Expand Up @@ -255,15 +255,15 @@ 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, ".+");
}

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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/crowdin/cli/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/messages/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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)
andrii-bodnar marked this conversation as resolved.
Show resolved Hide resolved

# CROWDIN GLOSSARY COMMAND
crowdin.glossary.usage.description=Manage glossaries
Expand Down Expand Up @@ -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'.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static Stream<Arguments> testStringAdd() {
}

@Test
public void testStirngAdd_throwsNotFound() {
public void testStringAdd_throwsNotFound() {
String text = "first text";
String identifier = "1.1";
Integer maxLength = 42;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PicocliTestUtils {

protected Actions actionsMock;
protected NewAction actionMock;
protected PropertiesBuilders properitesBuildersMock;
protected PropertiesBuilders propertiesBuildersMock;

@BeforeEach
public void beforeEach() {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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());
}
}