Flutter Polyglot CLI
Polyglot client for Flutter development
Installation
To install polyflut simply run:
gem install flutter_polyglot_cli
If you have any issues with above command, please consult this thread.
You can check if everything is OK running:
polyflut --help
You should see output with all commands and their description.
Usage
Login
You will have to login with your Infinum ID if you want to use polyglot:
polyflut login
If your login action is successful, polyglot will ask you to access Keychain. There it will save your access token, so you don’t have to enter your credentials every time when you use polyflut
command.
Setup
To setup polyglot in your Xcode project use:
polyflut init
It will prompt you with project list to select one you are setting up. You can provide source language (Swift/ObjC), translations path and resources path. It will create polyglot.yml
file which you can edit later and add additional Polyglot projects.
Also, you can pass optional parameter --query
or -q
. It will prompt you with a list of all projects that match specified query.
Projects
If you want to see all polyglot projects and their IDs
enter:
polyflut projects
Also, you can pass optional parameter --query
or -q
. It will prompt you with a list of all projects that match specified query.
Pull
Finally, to fetch translations use:
$ polyflut pull
This will generate a Localization folder in which you will have a Localization class, Localization Delegate, Localization Keys files and an initialize_i18n folder with .messages
files. This will also create .arb
files which contain key-value pairs for each language.
Usage
After all the files are generated, all you need to do is add Locales to supportedLocales
property and add LocalizationDelegate
to localizationsDelegates
property of your MaterialApp
. For iOS, you need to set supported locales in project configuration under the info tab.
Development
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/infinum/flutter-polyglot-cli.
License
The gem is available as open source under the terms of the MIT License.