diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ddc37..6c53ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,16 @@ # easy-i18n Changelog ## [Unreleased] -### Fixed -- NullPointerException on key completion -- Changelog handling in release flow +### Added +- Support for json based arb files (flutter) ### Changed - Updated plugin dependencies +### Fixed +- NullPointerException on key completion +- Changelog handling in release flow + ## [1.6.0] ### Added - The search function now supports full-text-search diff --git a/src/main/java/de/marhali/easyi18n/DataStore.java b/src/main/java/de/marhali/easyi18n/DataStore.java index d8fcd83..e41ecdc 100644 --- a/src/main/java/de/marhali/easyi18n/DataStore.java +++ b/src/main/java/de/marhali/easyi18n/DataStore.java @@ -29,7 +29,8 @@ import java.util.function.Consumer; public class DataStore { private static final Set STRATEGIES = new LinkedHashSet<>(Arrays.asList( - new JsonIOStrategy(), new ModularizedJsonIOStrategy(), + new JsonIOStrategy("json"), new ModularizedJsonIOStrategy("json"), + new JsonIOStrategy("arb"), new ModularizedJsonIOStrategy("arb"), new YamlIOStrategy("yaml"), new YamlIOStrategy("yml"), new PropertiesIOStrategy() )); diff --git a/src/main/java/de/marhali/easyi18n/io/json/JsonIOStrategy.java b/src/main/java/de/marhali/easyi18n/io/json/JsonIOStrategy.java index 40d57af..3152f47 100644 --- a/src/main/java/de/marhali/easyi18n/io/json/JsonIOStrategy.java +++ b/src/main/java/de/marhali/easyi18n/io/json/JsonIOStrategy.java @@ -27,10 +27,14 @@ import java.util.function.Consumer; * @author marhali */ public class JsonIOStrategy implements IOStrategy { - - private static final String FILE_EXTENSION = "json"; private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); + private final String FILE_EXTENSION; + + public JsonIOStrategy(@NotNull String fileExtension) { + this.FILE_EXTENSION = fileExtension; + } + @Override public boolean canUse(@NotNull Project project, @NotNull String localesPath, @NotNull SettingsState state) { VirtualFile directory = LocalFileSystem.getInstance().findFileByIoFile(new File(localesPath)); diff --git a/src/main/java/de/marhali/easyi18n/io/json/ModularizedJsonIOStrategy.java b/src/main/java/de/marhali/easyi18n/io/json/ModularizedJsonIOStrategy.java index 7e4d877..e05a086 100644 --- a/src/main/java/de/marhali/easyi18n/io/json/ModularizedJsonIOStrategy.java +++ b/src/main/java/de/marhali/easyi18n/io/json/ModularizedJsonIOStrategy.java @@ -33,9 +33,14 @@ import java.util.function.Consumer; */ public class ModularizedJsonIOStrategy implements IOStrategy { - private static final String FILE_EXTENSION = "json"; private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); + private final String FILE_EXTENSION; + + public ModularizedJsonIOStrategy(@NotNull String fileExtension) { + this.FILE_EXTENSION = fileExtension; + } + @Override public boolean canUse(@NotNull Project project, @NotNull String localesPath, @NotNull SettingsState state) { VirtualFile directory = LocalFileSystem.getInstance().findFileByIoFile(new File(localesPath));