resx_to_json 0.0.7 resx_to_json: ^0.0.7 copied to clipboard
Helps you to convert RESX files to JSON. You would want to use it during migration from Xamarin to Flutter.
While migration from Xamarin Forms to Flutter, you'd probably want to convert your localization files to json. This package is the perfect tool for it.
Note: For different extensions (like .arb) change the
extension
option in yourpubspec.yaml
file. See Usage
Installation #
You don't have to add any dependency to your project. Just activate resx_to_json
globally:
pub global activate resx_to_json
Usage #
- Add a new section
resx_to_json
to yourpubspec.yaml
file.
An example with all options:
resx_to_json:
# The directory containing resx files. The path can be relative or absolute.
source: C:\Users\Mazlum\source\repos\_MergeSoft\AsoGotin\AsoGotin\Properties
# The directory where the generated json files will be saved in. The path can be relative or absolute.
destination: assets/localization/
# Indicates whether the keys in json files should be sorted alphabetically. (Optional, default: true)
sort: true
# The extension for the generated json files. For example `arb`. (Optional, default: 'json')
extension: json
# The file where all keys in resx files are written as static properties. (Optional, default: 'lib/helpers/json_keys.dart')
json_keys_path: lib/utils/json_keys.dart
# Regex patterns for renaming resx files. (Optional)
# Notice that the search is case-sensitive
# <regex_pattern> => <replacement>
replacements:
- Resources\.resx => en.json
- Resources\.([a-z]+)\.resx => $1.json # $1 is the 1. match group. e.g. Resources.de.resx is renamed to de.json
- Run this command inside your flutter project root.
pub global run resx_to_json