polyglothq 1.1.1 polyglothq: ^1.1.1 copied to clipboard
Polyglot CLI in dart
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 context:
Strings.latest.keyName
- NOTE: Using translations without context is highly discouraged, and should only be used in special cases.