localaze 0.0.1 copy "localaze: ^0.0.1" to clipboard
localaze: ^0.0.1 copied to clipboard

A new localization helper package.

Provides ability to translate Json files to localized texts in a variety of languages. Run time localization for Flutter|Dart applications.

How to use: #

  1. import the package
import 'package:localaze/localaze.dart';
  1. Create a map of localized texts, or use json you fetched from the server.

final targetMap1 = <String, Map<String, String>>{
  'en': {
    'info_message': 'My name is {name} and I am {age} years old',
  },
  'az': {
    'info_message': 'Mənim adım {name} və mən {age} yaşındayam',
  },
};
  1. Set configuration and initialize the Localaze instance.
Translator.config = Translator.config.copyWith(
    translations: targetMap1,
    supportedLanguages: {'en', 'az'},
    translationsStructure: TranslationsStructureEnum.languageCodeFirst,
  );
  1. Set params for dynamic translations.
ParamModel name(String value) => ParamModel(key: 'name', value: value);

ParamModel age(int value) => ParamModel(key: 'age', value: "$value");
  1. Use the tr extension method to get the localized text.
print(Translator.translate('welcome_message', 'az', name('John'), age(23)));
1
likes
120
pub points
0%
popularity

Publisher

unverified uploader

A new localization helper package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on localaze