excel2arb 1.1.0
excel2arb: ^1.1.0 copied to clipboard
A Dart package that allows you to download an Excel file from a given URL and generate ARB (Application Resource Bundle) files.
๐ Excel to ARB Generator #
Tired of manually converting translation spreadsheets into .arb files for your Flutter or Dart projects? This command-line tool automates the process, letting you manage your localization in a simple Excel fileโand generates all the necessary Application Resource Bundle (.arb) files instantly.
๐ How It Works #
You provide a link to a specially formatted Excel file, and the tool generates the corresponding .arb files for each language, ready to be used in your application.
Excel File โ excel2arb Tool โ Generated .arb Files
๐ง Prerequisites #
Make sure you have the Dart SDK installed.
๐ฆ Installation #
Activate the package globally:
dart pub global activate excel2arb
This makes the excel2arb command available globally in your terminal.
๐ Step 1: Format Your Excel Sheet #
Create an Excel sheet following these key formatting rules. You can see a full example here.
โ Key Formatting Rules #
| Column | Description |
|---|---|
Name [name] |
Required. Used as the JSON key in .arb files. |
Language {locale} |
Required. Columns with language names and 2-letter locale in {}. E.g., English {en} |
Remark |
Optional. Notes or instructions for translators. |
Placeholders [placeholders] |
Optional. JSON object defining placeholders and their types. |
๐งพ Example Excel Layout #
Name [name] |
Description [description] |
Remark | English {en} |
Myanmar {my} |
Placeholders [placeholders] |
|---|---|---|---|---|---|
greeting |
A welcome message | Hello, World! | แแแบแนแแแฌแแซ แแฑแฌแแแผแฎแธ | ||
welcomeUser |
Welcomes a specific user | Keep {} as-is |
Hello {userName} |
แแแบแนแแแฌแแซ {userName} |
{"userName": {"type": "String"}} |
โ๏ธ Step 2: Run the Generator #
Once your Excel file is published and accessible via URL, run:
โถ๏ธ Basic Usage #
excel2arb --excel-url <your-excel-file-url> --output-directory <path-to-output-folder>
If the script isn't found, try:
dart pub global run excel2arb --excel-url <your-excel-file-url> --output-directory <path-to-output-folder>
๐งฐ Command-Line Options #
| Flag | Alias | Description | Default |
|---|---|---|---|
--excel-url |
-u |
(Required) Public URL of the Excel file | |
--sheet-name |
-s |
Sheet name to parse | Localization |
--output-directory |
-o |
Directory to save .arb files |
Current directory |
--gen-l10n |
-g |
Also generate l10n.yaml config |
false |
๐ก Full Example #
excel2arb -u https://example.com/sample.xlsx -s Localization -o output_dir -g true
๐ก Bonus Tip #1: Using Google Sheets #
You can use Google Sheets instead of Excel:
- Create your spreadsheet in Google Sheets (follow the same format).
- Go to File โ Share โ Publish to web.
- Under the Link tab, select the specific sheet.
- Change format to Microsoft Excel (.xlsx).
- Click Publish.
- Copy the generated link and use it with
--excel-url.
โ This gives you a live Excel download link, so your team can collaborate in real-timeโjust run the generator when you're ready.
๐ก Bonus Tip #2: Streamline with an IDE Plugin #
If you're using Android Studio or any JetBrains IDE, streamline the sync using the Dart Scripts Runner plugin.
๐ Setup #
- Install Dart Scripts Runner from JetBrains Marketplace.
- In
pubspec.yaml, add:
scripts:
sync_localization:
script: excel2arb -u https://shorturl.at/abcd -o lib/l10n/locales -g true
description: Sync localization from google sheet
- Replace the URL with your actual spreadsheet link.
- Now, you can run
sync_localizationdirectly from the Dart Scripts tool window in your IDEโjust one click!

โจ Features #
- โ Downloads Excel files directly from a URL
- โ
Generates
.arbfiles for all languages - โ Supports custom sheet names
- โ
Optionally generates
l10n.yaml - โ Handles placeholders and their types
๐ค Contributing #
Contributions are welcome! Feel free to open an issue or submit a PR on the GitHub repo.