Skip to content

Chewbacca-14/flutter_localization_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖥️ flutter_localization_generator

flutter_localization_generator is a Dart package for generating .arb localization files in Flutter. It simplifies the process of creating and maintaining localization files based on a provided .txt file.

How to Use

Add this repository to the dependencies in your Flutter project:

dependencies:
  flutter_localization_generator:
    git:
      url: https://github.com/Chewbacca-14/flutter_localization_generator.git

Run the following command in the Terminal:

dart run flutter_localization_generator --filePath <path_to_your_translate_file.txt> --languageCode <language_code> --type <en/other> --splitElement ";"

--filePath: path to your file with translations.

--languagecCode: language code for the translation (e.g., 'en' for English).

--type: use 'en' if you are creating a standard English translation file. Use 'other' if you are creating additional translation files.

--splitElement: specifies the element used to separate the values in the translation file. In the provided example, semicolon (;) is used as the split element.

Translation File Format

Your translation file (e.g., yourtranslatefile.txt) should have the following format:


Example of translate.txt

splitElement is ";"

welcome;Добро пожаловать;Welcome
helloworld;Привет Мир;Hello World

or splitElement is ".."

welcome..Добро пожаловать..Welcome
helloworld..Привет Мир..Hello World
  • Ensure that all values are separated by splitElement

Example


translate.txt

welcome;Добро пожаловать;Welcome
helloworld;Привет Мир;Hello World

RUN

dart run flutter_localization_generator --filePath C:\Users\Max\Downloads\translate.txt --languageCode en --type en --splitElement ";"

OUTPUT

app_en.arb

{
 "welcome": "Welcome",
 "@welcome": {
   "description": "Добро пожаловать"
 },
 "helloworld": "Hello World",
 "@helloworld": {
   "description": "Привет Мир"
 }
}

RUN

dart run flutter_localization_generator --filePath C:\Users\Max\Downloads\translate.txt --languageCode ru --type other --splitElement ";"

OUTPUT

app_ru.arb

{
 "welcome":"Добро пожаловать",
 "helloworld":"Привет Мир"
}

**Feel free to customize and use this package to streamline your Flutter localization process!**

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages