i18n_builder

Stars
7
  • 1.``
    1. script/i18n_builder dart run.dart .
cd script/i18n_builder # 
dart run.dart . #  lib  I18n 

run.dart


2.
cd script/i18n_builder # 
dart run.dart -D=lib,src,app -N=S #  lib/src/app  S 

lib/src/app S: I18n

S.of(context).XXX


3.

json languageCode_countryCode.json

`{}` {=}

---->[]----
I18n.of(context).info2(count: '$_counter')
I18n.of(context).info2(count: '$_counter',user: 'toly')

1.

pubspec.yaml flutter_localizations

dependencies:
  #...
  flutter_localizations: 
    sdk: flutter

MaterialApp

  • tag1 : I18nDelegate
  • tag2:
  • tag3 :
MaterialApp(
		//...
    localizationsDelegates: [ // tag1
      ...GlobalMaterialLocalizations.delegates,
      I18nDelegate.delegate 
    ],
    supportedLocales: I18nDelegate.delegate.supportedLocales, // tag2
    locale: const Locale('zh', 'CH'), // tag3
);

tag3 locale

Related Projects