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

Provide a type safe api when accessing the localization by generating dart files from i18next files

i18next_code_gen #

pub package


A plugin which supports code generation for i18next.

Getting Started #

Add the config to the build.yaml:

targets:
  $default:
    builders:
      i18next_code_gen:
        options:
          localizations: lib/i18n/en-US/*.json

Replace en-US with the main language. It is also possible to add an out-option to change the output file. The default file is lib/i18n/localizations.i18n.dart. Another option is to add flutter: false to support dart only environments.

Code generation #

Run the code generator once with dart run build_runner build or add a listener with dart run build_runner watch.

Usage #

Get the localization by importing /i18n/localizations.i18n.dart and calling Localization.of(context). This returns a variable which contains sub-variables and sub-sub-variables to get the localization.

Supported systems #

Supports all Dart and Flutter environments.

1
likes
130
points
48
downloads

Publisher

verified publisheropdehipt.com

Weekly Downloads

Provide a type safe api when accessing the localization by generating dart files from i18next files

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

build, code_builder, dart_style, glob

More

Packages that depend on i18next_code_gen