From 1598c2c80b638a88e48339f41d52f18b9e003462 Mon Sep 17 00:00:00 2001 From: Kateryna Oblakevych Date: Wed, 20 Sep 2023 16:27:36 +0300 Subject: [PATCH] bug: fix translations download without preserve hierarchy --- .../com/crowdin/cli/commands/actions/DownloadAction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java index b962305ee..fcc9190e3 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java @@ -405,7 +405,7 @@ private Map getFiles( return this.doTranslationMapping( forLanguages, fb.getDest(), fb.getTranslation(), serverLanguageMapping, languageMapping, - translationReplace, sources, fb.getSource(), basePath, placeholderUtil); + translationReplace, sources, fb.getSource(), basePath, placeholderUtil, preserveHierarchy); } private ProjectBuild buildTranslation(ProjectClient client, BuildProjectTranslationRequest request) { @@ -495,7 +495,8 @@ private Map doTranslationMapping( List sources, String source, String basePath, - PlaceholderUtil placeholderUtil + PlaceholderUtil placeholderUtil, + boolean preserveHierarchy ) { Map mapping = new HashMap<>(); @@ -505,6 +506,9 @@ private Map doTranslationMapping( String translationProject1 = placeholderUtil.replaceLanguageDependentPlaceholders(translation, projLanguageMapping, language); String translationFile1 = placeholderUtil.replaceLanguageDependentPlaceholders(translation, languageMapping, language); + if (!preserveHierarchy) { + translationProject1 = StringUtils.remove(translationProject1, PlaceholderUtil.PLACEHOLDER_ORIGINAL_PATH); + } for (String projectFile : sources) { String file = StringUtils.removeStart(projectFile, basePath);