Thursday, 28 January 2016

Installing drupalconsole on Windows



Trying to recall, how I have installed drupalconsole on Windows. By the way, somehow I had no problems at all ;-)

On my Windows 7 system I have found two ways to install drupalconsole. Later you will need Git Bash from the Git for Windows program package to run drupalconsole, so I recommend issuing the following command in the Git Bash prompt:

curl https://drupalconsole.com/installer -L -o drupal.phar

Running the other command from Git Bash gave me the "output is not a tty" error, and created a 0 size file, but running this from a Windows command prompt worked:

php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar

For the record I had PHP version 5.5.27 on my machine. At this point you can already run drupalconsole with issuing the "php drupal.phar" command, supposing the php.exe file is in your system PATH. Then you can rename the just downloaded drupal.phar file to any preferred name, eg. drupal or drupalconsole, and move it to the directory that contains your php.exe file. After this you can just type the name of your command in the Git Bash prompt, and create the configuration files. Since I have renamed my drupal.phar file to drupalconsole I use this in the example:

# Copy configuration files to user home directory:
drupalconsole init --override

Then run the next command to have drupalconsole update itself:

# Update DrupalConsole to the latest version:
drupalconsole self-update

Don't forget to always use the Git bash window to run drupalconsole.

Sunday, 24 January 2016

Translating drupal's yaml and po files on freetm.com


I am trying to find a solution to translate Drupal's .po and .yml files with a computer assisted translation (CAT) tool. Recently I had to use freetm.com, which I found quite useful, but it still has its own problems. For example you can only upload 10 files at a time. With drupal core's .po file it is not a problem, but as there are many .yml files, they have to be translated in batches of 10. Freetm.com supports the translation of XLIFF files, and the translation memory can be exported in the industry standard TMX format. I used the okapi framework to convert yml to xliff. As I remember, I have used it earlier to convert po files to xliff too.

To convert yaml files to xliff, run a command like:

tikal -x hu/user.delete.yml -seg -sl EN -tl HU -oe utf8

The -sl parameter specifies the source language, -tl specifies the target language with its 2 letter code.
After finishing the translation of .xlf files with freetm.com, copy the xlf files into the same directory as the original yml files, then run a command similar to the following:

tikal -m temp/*.xlf -sl EN -tl HU -oe utf8

Don't forget to add the output encoding (-oe), without it I have received ANSI encoded files.