From 424171e47885c922c2ce194f269ebde50460ef71 Mon Sep 17 00:00:00 2001 From: Jean Aurambault Date: Mon, 28 Aug 2023 14:05:19 -0700 Subject: [PATCH] Add support for HTML files in the webapp Basic support works but 1) the text unit name will change as soon as there is a change to the document which will prevent basic leveraging. It is just using an auto increment for new text unit. We need to look into some different logic for that, eg. md5 hashing of previous content + occurence count 2) if there are image, and maybe some other html element, they just get replaced by a placeholder in the localized file. Need to debug. --- cli/pom.xml | 3 +- .../mojito/cli/filefinder/FileFinder.java | 1 + .../mojito/cli/filefinder/file/FileTypes.java | 3 +- .../cli/filefinder/file/HtmlFileType.java | 9 ++++ .../mojito/cli/command/PullCommandTest.java | 45 +++++++++++++++++ .../mojito/cli/filefinder/FileFinderTest.java | 40 +++++++++++++++ .../cli/filefinder/file/HtmlFileTypeTest.java | 50 +++++++++++++++++++ .../pullHtml/expected/target/demo_fr-CA.html | 8 +++ .../pullHtml/expected/target/demo_fr.html | 8 +++ .../pullHtml/expected/target/demo_ja.html | 8 +++ .../pullHtml/input/source/demo.html | 10 ++++ .../translations/source-xliff_fr-FR.xliff | 48 ++++++++++++++++++ .../translations/source-xliff_ja-JP.xliff | 27 ++++++++++ .../findHtml/input/source/filefinder.html | 1 + .../input/source/sub/filefinder2.html | 1 + .../input/target/filefinder_fr-FR.html | 1 + .../findHtml/input/target/filefinder_fr.html | 1 + .../findHtml/input/target/notarget_fr.html | 0 .../input/target/sub/filefinder2_fr.html | 1 + common/pom.xml | 23 +++++++++ .../asset/AssetPathToFilterConfigMapper.java | 5 +- .../asset/FilterConfigurationMappers.java | 2 + .../AssetPathToFilterConfigMapperTest.java | 10 ++++ 23 files changed, 302 insertions(+), 3 deletions(-) create mode 100644 cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileType.java create mode 100644 cli/src/test/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileTypeTest.java create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr-CA.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_ja.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/source/demo.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_fr-FR.xliff create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_ja-JP.xliff create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/filefinder.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/sub/filefinder2.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr-FR.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/notarget_fr.html create mode 100644 cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/sub/filefinder2_fr.html diff --git a/cli/pom.xml b/cli/pom.xml index 0fa61bbd81..fc6c6ccd46 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -144,7 +144,8 @@ org.apache.maven.plugins maven-surefire-plugin - -Dspring.config.additional-location=optional:file://${user.home}/.l10n/config/cli/ + + -Dspring.config.additional-location=optional:file://${user.home}/.l10n/config/webapp/ -Dspring.profiles.active=${user.name},test -Xmx1024m diff --git a/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/FileFinder.java b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/FileFinder.java index 39cf6e3e45..7bdd44dbd5 100644 --- a/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/FileFinder.java +++ b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/FileFinder.java @@ -63,6 +63,7 @@ public FileFinder() { fileTypes.add(new JSFileType()); fileTypes.add(new TSFileType()); fileTypes.add(new YamlFileType()); + fileTypes.add(new HtmlFileType()); // TODO(ja) disable for now because this is likely to pickup a lot of files. it might be better // to ask for it explicitly // fileTypes.add(new JSONFileType()); diff --git a/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/FileTypes.java b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/FileTypes.java index 33661b39b8..57647d016a 100644 --- a/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/FileTypes.java +++ b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/FileTypes.java @@ -26,7 +26,8 @@ public enum FileTypes { CHROME_EXT_JSON(ChromeExtensionJSONFileType.class), I18NEXT_PARSER_JSON(I18NextFileType.class), TS(TSFileType.class), - YAML(YamlFileType.class); + YAML(YamlFileType.class), + HTML(HtmlFileType.class); Class clazz; diff --git a/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileType.java b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileType.java new file mode 100644 index 0000000000..4ded3624d3 --- /dev/null +++ b/cli/src/main/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileType.java @@ -0,0 +1,9 @@ +package com.box.l10n.mojito.cli.filefinder.file; + +/** @author jaurambault */ +public class HtmlFileType extends LocaleInNameFileType { + + public HtmlFileType() { + this.sourceFileExtension = "html"; + } +} diff --git a/cli/src/test/java/com/box/l10n/mojito/cli/command/PullCommandTest.java b/cli/src/test/java/com/box/l10n/mojito/cli/command/PullCommandTest.java index cae5295269..d45196ec38 100644 --- a/cli/src/test/java/com/box/l10n/mojito/cli/command/PullCommandTest.java +++ b/cli/src/test/java/com/box/l10n/mojito/cli/command/PullCommandTest.java @@ -954,6 +954,51 @@ public void pullPo() throws Exception { checkExpectedGeneratedResources(); } + @Test + public void pullHtml() throws Exception { + + Repository repository = createTestRepoUsingRepoService(); + System.setProperty("overrideExpectedTestFiles", "true"); + + getL10nJCommander() + .run( + "push", + "-r", + repository.getName(), + "-s", + getInputResourcesTestDir("source").getAbsolutePath()); + + Asset asset = assetClient.getAssetByPathAndRepositoryId("demo.html", repository.getId()); + importTranslations(asset.getId(), "source-xliff_", "fr-FR"); + importTranslations(asset.getId(), "source-xliff_", "ja-JP"); + + getL10nJCommander() + .run( + "pull", + "-r", + repository.getName(), + "-s", + getInputResourcesTestDir("source").getAbsolutePath(), + "-t", + getTargetTestDir("target").getAbsolutePath(), + "-lm", + "fr:fr-FR,fr-CA:fr-CA,ja:ja-JP"); + + getL10nJCommander() + .run( + "pull", + "-r", + repository.getName(), + "-s", + getInputResourcesTestDir("source_modified").getAbsolutePath(), + "-t", + getTargetTestDir("target_modified").getAbsolutePath(), + "-lm", + "fr:fr-FR,fr-CA:fr-CA,ja:ja-JP"); + + checkExpectedGeneratedResources(); + } + @Test public void removeUntranslated() throws Exception { diff --git a/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/FileFinderTest.java b/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/FileFinderTest.java index 258e9d5128..4a43e671ac 100644 --- a/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/FileFinderTest.java +++ b/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/FileFinderTest.java @@ -152,6 +152,46 @@ public void findXliff() throws IOException, FileFinderException { assertFalse(itTargets.hasNext()); } + @Test + public void findHtml() throws IOException, FileFinderException { + FileFinder fileFinder = initFileFinder(false); + + ArrayList sources = fileFinder.getSources(); + Collections.sort(sources); + + ArrayList targets = fileFinder.getTargets(); + Collections.sort(targets); + + Iterator itSources = sources.iterator(); + + FileMatch next = itSources.next(); + assertEquals(HtmlFileType.class, next.fileType.getClass()); + assertEquals( + getInputResourcesTestDir("source").toString() + "/filefinder.html", + next.getPath().toString()); + assertEquals("filefinder_fr-FR.html", next.getTargetPath("fr-FR")); + + next = itSources.next(); + assertEquals( + getInputResourcesTestDir("source").toString() + "/sub/filefinder2.html", + next.getPath().toString()); + assertEquals("sub/filefinder2_fr-FR.html", next.getTargetPath("fr-FR")); + + assertFalse(itSources.hasNext()); + + Iterator itTargets = fileFinder.getTargets().iterator(); + assertEquals( + getInputResourcesTestDir("target").toString() + "/filefinder_fr-FR.html", + itTargets.next().getPath().toString()); + assertEquals( + getInputResourcesTestDir("target").toString() + "/filefinder_fr.html", + itTargets.next().getPath().toString()); + assertEquals( + getInputResourcesTestDir("target").toString() + "/sub/filefinder2_fr.html", + itTargets.next().getPath().toString()); + assertFalse(itTargets.hasNext()); + } + @Test public void findXcodeXliff() throws IOException, FileFinderException { FileFinder fileFinder = initFileFinder(false, new XcodeXliffFileType()); diff --git a/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileTypeTest.java b/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileTypeTest.java new file mode 100644 index 0000000000..391ee16246 --- /dev/null +++ b/cli/src/test/java/com/box/l10n/mojito/cli/filefinder/file/HtmlFileTypeTest.java @@ -0,0 +1,50 @@ +package com.box.l10n.mojito.cli.filefinder.file; + +import static com.box.l10n.mojito.cli.filefinder.FilePattern.BASE_NAME; +import static com.box.l10n.mojito.cli.filefinder.FilePattern.FILE_EXTENSION; +import static com.box.l10n.mojito.cli.filefinder.FilePattern.LOCALE; +import static com.box.l10n.mojito.cli.filefinder.FilePattern.PARENT_PATH; + +import com.box.l10n.mojito.cli.filefinder.FilePattern; +import java.util.regex.Matcher; +import org.junit.Assert; +import org.junit.Test; + +/** @author jaurambault */ +public class HtmlFileTypeTest { + + @Test + public void testSourcePattern() { + HtmlFileType htmlFileType = new HtmlFileType(); + FilePattern sourceFilePattern = htmlFileType.getSourceFilePattern(); + Matcher matcher = sourceFilePattern.getPattern().matcher("/source/filefinder.html"); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals("/source/", matcher.group(PARENT_PATH)); + Assert.assertEquals("filefinder", matcher.group(BASE_NAME)); + Assert.assertEquals("html", matcher.group(FILE_EXTENSION)); + } + + @Test + public void testTargetPattern() { + HtmlFileType htmlFileType = new HtmlFileType(); + Matcher matcher = + htmlFileType.getTargetFilePattern().getPattern().matcher("/source/filefinder_fr.html"); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals("fr", matcher.group(LOCALE)); + Assert.assertEquals("/source/", matcher.group(PARENT_PATH)); + Assert.assertEquals("filefinder", matcher.group(BASE_NAME)); + Assert.assertEquals("html", matcher.group(FILE_EXTENSION)); + } + + @Test + public void testTargetPatternBcp47() { + HtmlFileType htmlFileType = new HtmlFileType(); + Matcher matcher = + htmlFileType.getTargetFilePattern().getPattern().matcher("/source/filefinder_fr-FR.html"); + Assert.assertTrue(matcher.matches()); + Assert.assertEquals("fr-FR", matcher.group(LOCALE)); + Assert.assertEquals("/source/", matcher.group(PARENT_PATH)); + Assert.assertEquals("filefinder", matcher.group(BASE_NAME)); + Assert.assertEquals("html", matcher.group(FILE_EXTENSION)); + } +} diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr-CA.html b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr-CA.html new file mode 100644 index 0000000000..ec36fe8a85 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr-CA.html @@ -0,0 +1,8 @@ + +

100 character description:

+
    +
  • 15 min
  • +
  • 1 day
  • +
  • 1 hour
  • +
  • 1 month
  • +
[#$dp12] \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr.html b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr.html new file mode 100644 index 0000000000..ec36fe8a85 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_fr.html @@ -0,0 +1,8 @@ + +

100 character description:

+
    +
  • 15 min
  • +
  • 1 day
  • +
  • 1 hour
  • +
  • 1 month
  • +
[#$dp12] \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_ja.html b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_ja.html new file mode 100644 index 0000000000..ec36fe8a85 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/expected/target/demo_ja.html @@ -0,0 +1,8 @@ + +

100 character description:

+
    +
  • 15 min
  • +
  • 1 day
  • +
  • 1 hour
  • +
  • 1 month
  • +
[#$dp12] \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/source/demo.html b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/source/demo.html new file mode 100644 index 0000000000..da80a369ea --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/source/demo.html @@ -0,0 +1,10 @@ + +

100 character description:

+
    +
  • 15 min
  • +
  • 1 day
  • +
  • 1 hour
  • +
  • 1 month
  • +
+ + \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_fr-FR.xliff b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_fr-FR.xliff new file mode 100644 index 0000000000..cecfc03988 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_fr-FR.xliff @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 character description: + Description de 100 caractères : + + + 15 min + 15 min + + + 1 day + 1 jour + + + 1 hour + 1 heure + + + 1 month + 1 mois¬ + + + + \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_ja-JP.xliff b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_ja-JP.xliff new file mode 100644 index 0000000000..208abff165 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/command/PullCommandTest_IO/pullHtml/input/translations/source-xliff_ja-JP.xliff @@ -0,0 +1,27 @@ + + + + + + 100 character description: + 100文字の説明: + + + 15 min + 15分 + + + 1 day + 1日 + + + 1 hour + 1時間 + + + 1 month + 1か月 + + + + diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/filefinder.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/filefinder.html new file mode 100644 index 0000000000..f83f789e7c --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/filefinder.html @@ -0,0 +1 @@ +HELLO=Hello {0}! \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/sub/filefinder2.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/sub/filefinder2.html new file mode 100644 index 0000000000..f83f789e7c --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/source/sub/filefinder2.html @@ -0,0 +1 @@ +HELLO=Hello {0}! \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr-FR.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr-FR.html new file mode 100644 index 0000000000..05a6fabc05 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr-FR.html @@ -0,0 +1 @@ +HELLO=Bonjour {0}! \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr.html new file mode 100644 index 0000000000..05a6fabc05 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/filefinder_fr.html @@ -0,0 +1 @@ +HELLO=Bonjour {0}! \ No newline at end of file diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/notarget_fr.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/notarget_fr.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/sub/filefinder2_fr.html b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/sub/filefinder2_fr.html new file mode 100644 index 0000000000..05a6fabc05 --- /dev/null +++ b/cli/src/test/resources/com/box/l10n/mojito/cli/filefinder/FileFinderTest_IO/findHtml/input/target/sub/filefinder2_fr.html @@ -0,0 +1 @@ +HELLO=Bonjour {0}! \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index ad8cdc4fc0..47f572ff58 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -266,6 +266,29 @@ + + net.sf.okapi.filters + okapi-filter-html + ${okapi.version} + + + log4j + log4j + + + org.slf4j + slf4j-log4j12 + + + net.sf.okapi.logbind + build-log4j + + + org.slf4j + slf4j-simple + + + net.sf.okapi.steps okapi-step-common diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapper.java b/common/src/main/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapper.java index d4e0164f02..d963274b72 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapper.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapper.java @@ -33,6 +33,8 @@ public class AssetPathToFilterConfigMapper { public static final String XTB_FILTER_CONFIG_ID = XMLFilter.FILTER_CONFIG_ID + "-xtb"; public static final String JS_FILTER_CONFIG_ID = JSFilter.FILTER_CONFIG_ID + "-js"; + public static final String HTML_FILTER_CONFIG_ID = "okf_html"; + private enum AssetFilterType { CSV(CSVFilter.FILTER_CONFIG_ID, "csv"), XLIFF(XLIFF_FILTER_CONFIG_ID, "xlf", "xliff", "sdlxliff", "mxliff"), @@ -45,7 +47,8 @@ private enum AssetFilterType { XTB(XTB_FILTER_CONFIG_ID, "xtb"), JS(JS_FILTER_CONFIG_ID, "ts", "js"), JSON(JSONFilter.FILTER_CONFIG_ID, "json"), - YAML(YamlFilter.FILTER_CONFIG_ID, "yaml"); + YAML(YamlFilter.FILTER_CONFIG_ID, "yaml"), + HTML(HTML_FILTER_CONFIG_ID, "html"); private String configId; private Set supportedExtensions = new HashSet<>(); diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/asset/FilterConfigurationMappers.java b/common/src/main/java/com/box/l10n/mojito/okapi/asset/FilterConfigurationMappers.java index 7c6217d826..9110b8b652 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/asset/FilterConfigurationMappers.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/asset/FilterConfigurationMappers.java @@ -3,6 +3,7 @@ import com.box.l10n.mojito.okapi.filters.*; import net.sf.okapi.common.filters.DefaultFilters; import net.sf.okapi.common.filters.IFilterConfigurationMapper; +import net.sf.okapi.filters.html.HtmlFilter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; @@ -41,6 +42,7 @@ public IFilterConfigurationMapper getConfiguredFilterConfigurationMapper() { mapper.addConfigurations(JSONFilter.class.getName()); mapper.addConfigurations(XcodeXliffFilter.class.getName()); mapper.addConfigurations(YamlFilter.class.getName()); + mapper.addConfigurations(HtmlFilter.class.getName()); return mapper; } diff --git a/common/src/test/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapperTest.java b/common/src/test/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapperTest.java index 15a2b41ef6..94f1e3f50e 100644 --- a/common/src/test/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapperTest.java +++ b/common/src/test/java/com/box/l10n/mojito/okapi/asset/AssetPathToFilterConfigMapperTest.java @@ -172,4 +172,14 @@ public void testGetFilterConfigIdFromTypeWithYAML() throws Exception { assetPathToFilterConfigMapper.getFilterConfigIdFromPath("/path/to/File.yaml"); assertEquals(YamlFilter.FILTER_CONFIG_ID, filterConfigId); } + + @Test + public void testGetFilterConfigIdFromTypeWithHTML() throws Exception { + + AssetPathToFilterConfigMapper assetPathToFilterConfigMapper = + new AssetPathToFilterConfigMapper(); + String filterConfigId = + assetPathToFilterConfigMapper.getFilterConfigIdFromPath("/path/to/content.html"); + assertEquals(AssetPathToFilterConfigMapper.HTML_FILTER_CONFIG_ID, filterConfigId); + } }