enhancement Success

User tests: Successful: Unsuccessful:

avatar elkuku
elkuku
1 Jun 2014

This will make the output of the CLI commands install and get translatable.

Maybe the command line gets a little less scary if it's in the users native language?

avatar elkuku elkuku - open - 1 Jun 2014
avatar b2z
b2z - comment - 16 Jul 2014

Tried to test, but have a permission problem:

vagrant@debian-7:/vagrant/cli$ php tracker.php make langtemplates

Warning: mkdir(): Permission denied in /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php on line 170

Call Stack:
    0.0005     227896   1. {main}() /vagrant/cli/tracker.php:0
    0.0716     965232   2. Application\Application->__construct() /vagrant/cli/tracker.php:40
    0.2034    1540064   3. Application\Application->loadLanguage() /vagrant/cli/Application/Application.php:126
    0.2161    1697352   4. g11n\g11n::loadLanguage() /vagrant/cli/Application/Application.php:539
    0.2360    1839848   5. g11n\Language\Storage\File\Php->retrieve() /vagrant/vendor/elkuku/g11n/library/g11n/g11n.php:161
    0.2360    1840304   6. g11n\Language\Storage\File\Php->store() /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php:199
    0.2395    1849024   7. mkdir() /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php:170

Warning: file_put_contents(/tmp/g11n/CLI/cli/en-GB.cli.php): failed to open stream: No such file or
directory in /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php on line 173

Call Stack:
    0.0005     227896   1. {main}() /vagrant/cli/tracker.php:0
    0.0716     965232   2. Application\Application->__construct() /vagrant/cli/tracker.php:40
    0.2034    1540064   3. Application\Application->loadLanguage() /vagrant/cli/Application/Application.php:126
    0.2161    1697352   4. g11n\g11n::loadLanguage() /vagrant/cli/Application/Application.php:539
    0.2360    1839848   5. g11n\Language\Storage\File\Php->retrieve() /vagrant/vendor/elkuku/g11n/library/g11n/g11n.php:161
    0.2360    1840304   6. g11n\Language\Storage\File\Php->store() /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php:199
    0.2773    1848912   7. file_put_contents() /vagrant/vendor/elkuku/g11n/library/g11n/Language/Storage/File/Php.php:173

ERROR: Unable to write language storage file to /tmp/g11n/CLI/cli/en-GB.cli.php
avatar elkuku
elkuku - comment - 16 Jul 2014

Hmm, I am a little lost since I can not reproduce this error :(
Could you manually set the permission for the /tmp directory to 0777 if they are set to anything else and re-try ?

avatar b2z
b2z - comment - 17 Jul 2014

Strange... Why I have it? :)

Without root access (I do not know the password is) I can't.

vagrant@debian-7:/$ chmod +x /tmp
chmod: changing permissions of `/tmp': Operation not permitted
avatar elkuku
elkuku - comment - 17 Jul 2014

Try sudo ;)

sudo chmod 0777 /tmp

avatar elkuku
elkuku - comment - 17 Jul 2014

Hmm, you should encounter the same problem if you access the "front end" of the Vagrant box with http://127.0.0.1:2345/

Could you verify that cache files are written to /tmp inside the box?

avatar elkuku
elkuku - comment - 17 Jul 2014

Another hmm.... OK I found out that you can not use the same cache dir for web and CLI...

Instead of the chmod you can simply wipe the cache dir before running the CLI script (using sudo) like
sudo rm -rf /tmp/g11n

Not sure how to fix this properly :(

avatar elkuku
elkuku - comment - 17 Jul 2014

OK last Hmm...
I think I fixed this in elkuku/g11n@4bd0d91 - next dependency update should bring this in ;)

Sorry for the confusion :(

avatar b2z
b2z - comment - 17 Jul 2014

sudo rm -rf /tmp/g11n did the job and I've manged to create templates. But where the language files are stored? make langfiles command is working, but I can't find the files :)

And yes I get permission denied error now. Can you add deps update to solve it?

avatar elkuku
elkuku - comment - 17 Jul 2014

You are right, that part was missing...
Since we use Transifex now to "create" the language files, the template file has to be uploaded first.
I have however updated the make langfiles command to create the language files. I have also updated the update transifex and get transifex commands - but I have not tested them ;)

I've also updated the composer.json file.

avatar b2z
b2z - comment - 19 Jul 2014

Good. Now how to change the language? I see this in the code:
$lang = $this->input->get('lang');
But do not understand how to pass it :)

One more bug I found. Running get help throws an error:

Fatal error: Class Application\Command\Help\Help contains 1 abstract method and must therefore be declared abstract or i
mplement the remaining methods (Application\Command\TrackerCommand::__construct) in /vagrant/cli/Application/Command/Hel
p/Help.php on line 23

Call Stack:
    0.0006     227896   1. {main}() /vagrant/cli/tracker.php:0
    0.1634    1929136   2. Joomla\Application\AbstractApplication->execute() /vagrant/cli/tracker.php:40
    0.1634    1929168   3. Application\Application->doExecute() /vagrant/vendor/joomla/application/src/AbstractApplication.php:105
    0.1687    1941888   4. Application\Application->getAlternatives() /vagrant/cli/Application/Application.php:221
    0.1687    1942424   5. Composer\Autoload\ClassLoader->loadClass() /vagrant/cli/Application/Application.php:0
    0.1694    1942536   6. Composer\Autoload\includeFile() /vagrant/vendor/composer/ClassLoader.php:270
    0.1731    1989000   7. include('/vagrant/cli/Application/Command/Help/Help.php') /vagrant/vendor/composer/ClassLoader.php:378
avatar elkuku
elkuku - comment - 19 Jul 2014

Good. Now how to change the language?

Like this:

 $ ./cli/tracker.php install --lang=ru-RU                                    
------------------------------------------------------------
          Joomla! Tracker CLI Применение
                         1.0.0-beta
------------------------------------------------------------
------------------------------------------------------------
                     Монтажник
------------------------------------------------------------

ПРЕДУПРЕЖДЕНИЕ: база данных была обнаружена!

Вы хотите, чтобы переустановить?

1) да
2) нет

Выберите:

Here is a (Google translated) file I used for testing: http://pastebin.com/Cn77xbdj
BTW I used this very interesting technique: http://barry.coffeesprout.com/translating-po-files-using-google-translate/

Sorry, but I really like our colors :)

debug-3871

One more bug I found. Running get help throws an error:

Has been fixed :wink:

avatar b2z
b2z - comment - 19 Jul 2014

All is good!

avatar b2z b2z - change - 19 Jul 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-19 17:31:46
avatar b2z b2z - close - 19 Jul 2014
avatar b2z b2z - reference | - 19 Jul 14
avatar b2z b2z - merge - 19 Jul 2014
avatar b2z b2z - close - 19 Jul 2014
avatar b2z b2z - head_ref_deleted - 19 Jul 2014
avatar b2z
b2z - comment - 19 Jul 2014

@mbabker a note for you - update deps after deployment, because composer.json was updated :wink:

avatar elkuku
elkuku - comment - 19 Jul 2014

I just tested the 'get transifex' and 'update transifex' commands, and they seem to work OK :wink:

avatar b2z
b2z - comment - 27 Jul 2014

Interesting that on Windows (not a Vagrant box) I have a problem with the characters encoding
issue

avatar elkuku
elkuku - comment - 27 Jul 2014

Interesting but not surprising :wink:

Add a Comment

Login with GitHub to post a comment