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

outdated

Polyglot CLI in dart

Polyglothq Dart CLI #

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 -sgit git@github.com:infinum/flutter-polyglot.git

Usage #

Authorize polyglot #

Before using polyglothq, you'll need to login 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 direcotry 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

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 context:

Strings.latest.keyName

  • NOTE: Using translations without context is highly discouraged, and should only be used in special cases.