polyglothq 1.1.4 copy "polyglothq: ^1.1.4" to clipboard
polyglothq: ^1.1.4 copied to clipboard

polyglothq is a Dart CLI to support using Polyglot for Flutter projects. polyglothq fetches translations from polyglothq.com, and converts them to a Flutter-suitable form.

Polyglothq Dart CLI #

THIS IS AN INTERNAL TOOL AND MIGHT NOT BE USEFUL FOR YOU

polyglothq is a Dart CLI to support using Polyglot for Flutter projects. polyglothq fetches translations from polyglothq.com, and converts them to a Flutter-suitable form.

How to install #

You can install polyglothq by running the following command in your terminal.

dart pub global activate polyglothq

Usage #

Authorize polyglot #

Before using polyglothq, you'll need to log in using your Infinum credentials. Run the following command to login:

polyglothq login

You'll be asked for your email and password.

Initialize polyglot in your project #

To start using polyglothq in your project, run the following command in the directory that contains your project:

polyglothq init

You'll be asked to select your project from the list of polyglot projects.

Pull translations from polyglot #

Run the following command to pull translations from Polyglot.

polyglothq pull

What to do if I have the same language with different country codes? #

Use the defaultCountryCode section in polyglot.yml to specify default country code.

:defaultCountryCode:
  en: GB
  sw: SW

Flutter usage #

In your flutter code,

Strings.of(context).keyName

// With parameters
Strings.of(context).keyName('arg0', 'arg1', ...)

In cases, where you don't have access to the context:

  1. You'll need first to add the following widget:
MaterialApp(
  builder: (context, child) {
    return StringsLocaleWidget(child: child!); // Use StringsLocaleWidget
  },
);
  1. Then you can use:

Strings.latest.keyName

  • NOTE: Using translations without context is highly discouraged, and should only be used in special cases.
3
likes
130
pub points
0%
popularity

Publisher

verified publisherinfinum.com

polyglothq is a Dart CLI to support using Polyglot for Flutter projects. polyglothq fetches translations from polyglothq.com, and converts them to a Flutter-suitable form.

Homepage

Documentation

API reference

License

MIT (LICENSE)

Dependencies

args, console, dio, get_it, japx, json_annotation, recase, yaml

More

Packages that depend on polyglothq