localization_generator 0.0.5 copy "localization_generator: ^0.0.5" to clipboard
localization_generator: ^0.0.5 copied to clipboard

outdated

A flutter project that used to generate the localization file to help localization easier.

localization_generator #

A command tool to generate localization from JSON file.

Usage #

create en.json and zh_Hant.json at l10n folder

en.json

{
  "Title": "Hello {{name}}",
  "Home": "Home"
}

zh_Hant.json

{
  "Title": "你好 {{name}}",
  "Home": "首頁"
}

and run this command

flutter pub run localization_generator --output=./l10n --input=./l10n
import 'l10n/localization.dart';

MaterialApp(
  onGenerateTitle: (context) {
    return Localized.of(context).Title(name: "my name");
  },
  theme: ThemeData(
    primarySwatch: Colors.blue,
  ),
  localizationsDelegates: [
    Localized.delegate,
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate
  ],
  supportedLocales: Localized.delegate.supportedLocales,
  home: Builder(builder: (context) {
    return MyHomePage(title: Localized.of(context).Home);
  }),
);
4
likes
0
pub points
35%
popularity

Publisher

unverified uploader

A flutter project that used to generate the localization file to help localization easier.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, flutter, path

More

Packages that depend on localization_generator