Features
- Effortless Conversion: Quickly transforms
.xlsxfiles into.arbfiles. - Placeholder Support: Automatically handles dynamic values (e.g.,
{name}) with type definitions for robust localization. - Description Inclusion: Supports adding descriptive context for each translation key.
- Command-Line Interface: Easy to integrate into your build or CI/CD workflows using familiar flags.
Installation
You can activate this tool globally on your system, making it accessible from any directory.
dart pub global activate excel_to_arb
Usage
Excel File Preparation
- Name must follow pattern: app_*.xlsx (e.g.,
app_my.xlsx) - Structure your spreadsheet with these columns:
| Key | Value | Description (optional) | Placeholder (name:type) | | ------- | ------------ | ---------------------- | ----------------------- | | hello | မင်္ဂလာပါ | Greeting text | name:String , age: int | | goodbye | နုတ်ဆက်ပါတယ် | Farewell text | name:String , age: int |
Example Files: You can find sample Excel files demonstrating this structure in the resources/l10n directory of this repository:
https://github.com/Kaung-Myat/excel_to_arb/tree/main/resources/l10n
Running the Converter
Once your Excel files are prepared, run the tool from your terminal.
excel_to_arb --source <path/to/source/excel/dir> --target <path/to/target/arb/dir>
Arguments:
-
-s,--source: (Required) The path to the directory containing yourapp_*.xlsxfiles. -
-t,--target: (Required) The path to the directory where the generatedapp_*.arbfiles will be saved. The tool will create this directory if it doesn't exist. -
-h,--help: Displays usage information and available options.
Example
excel_to_arb --source /path/to/your_project/resources/l10n --target /path/to/your_project/config/l10n