easy_arb_gen 1.0.1 copy "easy_arb_gen: ^1.0.1" to clipboard
easy_arb_gen: ^1.0.1 copied to clipboard

csv_to arb gen

easy_arb_gen #

The easy_arb_gen package provides a simple and convenient way to convert CSV language files to ARB files for localization in Flutter projects.

Features #

  • Convert CSV language files to ARB files effortlessly.
  • Customize the CSV file path, output directory, and file name prefix in the pubspec.yaml file.
  • Support for specifying languages in the CSV file.
  • Option to include descriptions in the CSV file

Installation #

Add this to your pubspec.yaml file:

dev_dependencies: easy_arb_gen: ^<LATEST_VERSION>

Getting started #

Supporting CSV Templates #

The easy_arb_gen package is designed to support two types of CSV templates, offering flexibility in managing localization data for your Flutter projects:

1. Normal CSV Template #

Use this template when each row represents a translation key, and each column represents a language. The first column contains the keys, and subsequent columns contain translations for each specified language.

Example:

key, lang1, lang2, lang3,..etc
home_title, Home, ගෙදර, Hogar,..etc

2. Description CSV Template #

For more detailed localization, use this template that includes an additional column for descriptions. The first column contains the keys, the second column contains descriptions, and subsequent columns contain translations for each language.

Example:

key, description, lang1, lang2, lang3,...etc
home_title, The title for the home screen, Home, ගෙදර, Hogar,..etc

To use this package, follow these steps: #

Step 1: Add the following to your pubspec.yaml file:

easy_arb_gen:
  csv_filepath: "assets/langs/translations.csv"
  output_directory: "lib/l10n"
  output_file_prepend: "app_"
  csv_options:
    langs:
      - en
      - si
      - es
    is_description_have: false

Important Note #

When configuring the easy_arb_gen section in your pubspec.yaml file, ensure to set the is_description_have option according to your CSV template:

  • For Normal CSV Template (is_description_have: false)
  • For Description CSV Template (is_description_have: true)

Step 2: Run the Package and Experience the Magic!

Now that you've configured the easy_arb_gen section in your pubspec.yaml file, it's time to generate your ARB files and experience the magic of easy localization. Follow these steps:

  1. Open a terminal in the root directory of your Flutter project.

  2. Run the following command:

dart run package:easy_arb_gen

Additional information #

If you encounter any issues or have suggestions for improvement, feel free to file an issue. Your feedback is valuable, and we appreciate your help in making this package better.

Contributions are welcome! If you'd like to contribute to the development of the easy_arb_gen package, check out the contribution guidelines to get started. We look forward to your contributions!

4
likes
130
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

csv_to arb gen

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

yaml

More

Packages that depend on easy_arb_gen