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..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, @@ -68,7 +67,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%")) ); }