In the latest builds of Known, I’ve added support for Gettext translations. This can operate in tandem with the string array mechanism used previously, but it is my hope that using gettext will make translations easier, as there is a more complete tool chain available.

Creating .POT file

The first step, after you’ve used \Idno\Core\Idno::site()->language()->_() to write your strings, is to generate a POT template translation file. To do this, in /languages/ there’s a helpful script, go into this directory and run the script

./makepot.sh /path/to/your/plugin > /path/to/your/plugin/languages/

This will parse all your plugin’s PHP files and extract translatable strings.

Creating your translation

Open up your .POT file with a suitable tool, e.g. poedit, and save your .mo and .po files as /path/to/your/plugin/languages/LOCALE/LC_MESSAGES/DOMAIN.mo|po, where:

  • LOCALE is the locale you’re writing for, e.g. pt_BR
  • DOMAIN is the domain, e.g. your plugin name ‘myplugin’

Registering your translation

In your plugin, register your language by registering a new GetTextTranslation class, passing the path of your languages directory, and the domain you used.

So, for the above example this might look like:

function registerTranslations()
{
    \Idno\Core\Idno::site()->language()->register(
        new \Idno\Core\GetTextTranslation(
            'myplugin',
            dirname(__FILE__) . '/languages/'
        )
    );
}

I’ve been doing a bit of spring cleaning to the Known repo, removing unnecessary files, tidying up various bits and bobs. One thing I did, because it actually made some client work testing easier, was to move the Known vagrant wrapper into its own repo.

This makes the wrapper much easier to maintain and deploy (for me at least). I also took the liberty of tidying up a number of issues with the ansible configuration which was preventing the provisioning script from working properly.

Usage

You need to download and install a number of tools first, namely: VirtualBox, Vagrant, and Ansible.

Next, you need to check out a copy of the Known repo (or your Known based product environment) into a sub directory called Known. Symlinks should also work.

Run vagrant, and your new Known install will be provisioned as withknown on 192.168.33.33, I recommend modifying your /etc/hosts file to alias this.

Hope you find this useful!

» Visit the project on Github...



Vagrant logo by Fco.pljOwn work, CC BY-SA 3.0, Link

One of the deprecated features of Known is video support. This was build in to the Audio plugin back when it was the Media plugin, but it didn’t really work very well.

The missing component was video transcoding – converting the uploaded video into something that can be played in the browser. This plugin attempts to fill that hole…

Installation

  • Drop VideoTranscode into your IdnoPlugins directory and activate
  • Install ffmpeg sudo apt-get install ffmpeg x264
  • Configure the location of ffmpeg and qt-faststart

Now, when you upload a video, it will be queued and transcoded.

It is strongly recommended that you use the Asynchronous Queue in your Known configuration as this will do the transcoding in the background.

You should also run the service queue as the web server user, so that it can read and write files, e.g.

sudo -u www-data KNOWN_DOMAIN='your.domain' ./known.php service-event-queue

» Visit the project on Github...