Skip to content

juliansteenbakker/intl_converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intl_converter

A library tool that help you manager i18n strings in flutter,include convert from android "strings-xx.xml". Before to use,you need to know what is LocalizationsDelegate and what is intl_translation.

Flutter use arb file to manager i18n strings. some times you need to refactor an old android project use flutter.

intl_converter can help you convert android strings-xx.xml to flutter's arb file,and auto generate Dart class include all the strings define.You just need to extend the Dart class and registe with LocalizationsDelegate.

Flutter's internationalization reference: https://github.com/flutter/website/tree/master/examples/internationalization/intl_example/lib

Install

dev_dependencies:
  intl_converter: version

Use build args

--scan-dir the path where to scan android style strings-xx.xml files

--out-dir ARB and dart file output path

--gen-class the dart class name of auto generated

--file-name the dart file name of auto generated.default is:"strings_define.dart" (defaults to "strings_define.dart")

--dev-locale use which locale content to generate default dart class

build: flutter packages pub run intl_converter:build --scan-dir=xx --out-dir=yy --gen-class=zz

Use json config 'intl_converter.json'

{
  "scan-dir": "assets/i18n",
  "out-dir": "lib/i18n/gen",
  "gen-class": "AppStringsDefine",
  "dev-locale": "zh"
}

build: flutter packages pub run intl_converter:build

About

A dart library for converting Android XML strings to Flutter ARB strings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published