We are getting close hope by the end of this week, to a code-freeze on the development of this project, this code-freeze will be for about 4 weeks, in order to have time to work on the project documentation and prepare with David Flores aka @dmouse to present this project at DrupalCon Latino.
The first goal to complete before this code-freeze was add multilingual capabilities to the project, but why?, I can list a few reasons.
As I mentioned on twitter:
Code look a little hacky but got a translatable version of #Drupal Console commands, feature will be available on the next release. #drupal8
— Jesus Manuel Olivas (@jmolivas) January 2, 2015
Adding the Symfony Translation Component to the composer.json file
For more information about the Translation Component look the awesome symfony documentation here.
Add translation files and messages
Actually four languages files are available (en, es, fr and pt) you can find those files here, take note those files are only a copy of the console.en.yml file with few overrides for testing purposes.
Create a new Helper class
In order to take care of the translation the TranslatorHelper class was added see code here, the Helper was also registered at bin/conosle.php see code here
Inject the TranslatorHelper
For this task was necessary to modify the RegisterCommandsHelper class, obtaining the TranslatorHelper and Injecting via the constructor when creating and registering a new instance of each command.
You can see the full class here
Feel free to take a look at the messages at the github repo and send us fixes.
How to override the default language
As simple as creating a new YAML file at your home directory ~/.console/config.yml and override the language value.
How to make a console.phar
We are using and recommend this great project http://box-project.org/
Feel free to try this new multilingual feature on the latest release v0.6.0, and as usual feel free to ask any questions commenting on this page, or adding a new issue on the drupal project page or the github repository.