Developed with 💙 by Raul Mabe
Dart tool to convert from ARB to CSV and viceversa.
- Field delimiter must be
,
. - Key must be column with index
0
. - Description is mandatory (empty cells will be ignored when generating ARB) and must be column with index
1
. - Base language must be column with index
2
. - eol must be
\r\n
.
Check /example
folder to see the formatted files.
If the CLI application is available on pub, activate globally via:
dart pub global activate arb_tooling
Or locally via:
dart pub global activate --source=path <path to this package>
Or execute the binary (bin/arb_tooling.exe
); which can be generated via:
dart compile exe bin/arb_tooling.dart
- ✅ Convert from ARB files to CSV file
# To CSV command
$ dart ./bin/arb_tooling.dart to_csv -i example/input/arb -o example/output
- ✅ Convert from CSV file to ARB files
# From CSV command
$ dart ./bin/arb_tooling.dart from_csv -i example/input/csv/translations.csv -o example/output -p app_
- ✅ Convert from CSV file hosted in URL to ARB files
# From CSV command -> URL
$ dart ./bin/arb_tooling.dart from_csv -u https://docs.google.com/spreadsheets/d/{sheet_id}/export\?format\=csv\&id\={sheet_id}\&gid\={gid} -o example/output -p app_
- ✅ Rename files and directory names recursively inside a directory
# File rename
$ dart ./bin/arb_tooling.dart file_rename -i ./lib/src/models --from-name settings --to-name config
- More
# Show CLI version
$ arb_tooling --version
# Show usage help
$ arb_tooling --help
A CSV file of the form
key | description | en | es |
---|---|---|---|
hello | Hello world | Hello world! | Hola mundo! |
placeholder | Example of placeholder | Hello {name} | Hola {name} |
plural | Example of plural | {number,plural, =0{Sold out} =1{1 spot left} other{{number} spots left}} | {number,plural, =0{Agotadas} =1{1 plaza libre} other{{number} plazas libres}} |
endOfLine | Example of end of line | Enter it below to verify it.\r\n Check your spam folder as well. |
Introducelo para verificar.\r\n Mira la carpeta de spam también. |
generates the following ARB files
en.arb
{
"@@locale": "en",
"hello": "Hello world!",
"@hello": {
"description": "Hello world"
},
"placeholder": "Hello {name}",
"@placeholder": {
"description": "Example of placeholder",
"placeholders": {
"name": {}
}
},
"plural": "{number,plural, =0{Sold out} =1{1 spot left} other{{number} spots left}}",
"@plural": {
"description": "Example of plural",
"placeholders": {
"number": {}
}
},
"endOfLine": "Enter it below to verify it.\nCheck your spam folder as well.",
"@endOfLine": {
"description": "Example of end of line"
}
}
es.arb
{
"@@locale": "es",
"hello": "Hola mundo!",
"@hello": {
"description": "Hello world"
},
"placeholder": "Hola {name}",
"@placeholder": {
"description": "Example of placeholder",
"placeholders": {
"name": {}
}
},
"plural": "{number,plural, =0{Agotadas} =1{1 plaza libre} other{{number} plazas libres}}",
"@plural": {
"description": "Example of plural",
"placeholders": {
"number": {}
}
},
"endOfLine": "Introducelo para verificar.\nMira la carpeta de spam también.",
"@endOfLine": {
"description": "Example of end of line"
}
}
This ARB file can then be converted into localization delegates using intl or intl_utils.
Note
This process can also be reversed via the to_csv
commmand.