add support for arb files (flutter)

Resolves #64
This commit is contained in:
Marcel Haßlinger 2021-12-07 13:22:10 +01:00
parent d66cf3595e
commit bf1338ffa0
4 changed files with 20 additions and 7 deletions

View File

@ -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

View File

@ -29,7 +29,8 @@ import java.util.function.Consumer;
public class DataStore {
private static final Set<IOStrategy> 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()
));

View File

@ -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));

View File

@ -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));