From f952f5834090da70a5576528efaeecbd184bd1a2 Mon Sep 17 00:00:00 2001 From: yzerk Date: Wed, 21 Jun 2023 10:09:39 +0300 Subject: [PATCH 1/2] fix: translation pattern creation on windows --- .../cli/commands/functionality/TranslationsUtils.java | 2 +- .../cli/commands/functionality/TranslationsUtilsTest.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/functionality/TranslationsUtils.java b/src/main/java/com/crowdin/cli/commands/functionality/TranslationsUtils.java index 59656c063..0b614b533 100644 --- a/src/main/java/com/crowdin/cli/commands/functionality/TranslationsUtils.java +++ b/src/main/java/com/crowdin/cli/commands/functionality/TranslationsUtils.java @@ -28,7 +28,7 @@ public static String replaceDoubleAsterisk(String sourcePattern, String translat String[] sourceNodes = sourcePattern.split("\\*\\*"); for (int i = 0; i < sourceNodes.length; i++) { if (sourceFile.contains(sourceNodes[i])) { - sourceFile = StringUtils.substring(sourceFile, sourceFile.indexOf(Utils.regexPath(sourceNodes[i])), sourceFile.length() - 1) + sourceFile = StringUtils.substring(sourceFile, sourceFile.indexOf(sourceNodes[i]), sourceFile.length() - 1) .replaceFirst(Utils.regexPath(sourceNodes[i]), ""); } else if (sourceNodes.length - 1 == i) { if (sourceNodes[i].contains(Utils.PATH_SEPARATOR)) { diff --git a/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java b/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java index 0e7c13dff..931b0f13c 100644 --- a/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java +++ b/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java @@ -68,7 +68,12 @@ static Stream testReplaceDoubleAsterisk() { Utils.normalizePath("/*/**/*.po"), Utils.normalizePath("/%two_letters_code%/**/%original_file_name%"), Utils.normalizePath("hmm/here/file.po"), - Utils.normalizePath("/%two_letters_code%/hmm/here/%original_file_name%")) + Utils.normalizePath("/%two_letters_code%/hmm/here/%original_file_name%")), + arguments( + Utils.normalizePath("/english/**/*.yml"), + Utils.normalizePath("/%language%/**/%file_name%_l_%language%.%file_extension%"), + Utils.normalizePath("english/folder/messages_l_english.yml"), + Utils.normalizePath("/%language%/folder/%file_name%_l_%language%.%file_extension%")) ); } From 1a9e320f42a8050548e4b7a0951052edefce25c1 Mon Sep 17 00:00:00 2001 From: yzerk Date: Fri, 23 Jun 2023 13:15:12 +0300 Subject: [PATCH 2/2] fix: enable test on windows --- .../cli/commands/functionality/TranslationsUtilsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java b/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java index 931b0f13c..a059ad488 100644 --- a/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java +++ b/src/test/java/com/crowdin/cli/commands/functionality/TranslationsUtilsTest.java @@ -20,7 +20,6 @@ public class TranslationsUtilsTest { @ParameterizedTest @MethodSource - @DisabledOnOs(OS.WINDOWS) public void testReplaceDoubleAsterisk(String sourcePattern, String translationPattern, String sourceFile, String expected) { String result = TranslationsUtils.replaceDoubleAsterisk(sourcePattern, translationPattern, sourceFile); assertEquals(expected, result,