This is a very quick one, but I’ve added PHP 7.2 support to the Known vagrant build, which lives on a separate branch.
Until we wait for PHP 7.2 to enter the official ubuntu repos, this build uses an unofficial apt repo to obtain PHP 7.2.
I got a little bit of time recently, so I’ve updated the Known vagrant build.
The latest vagrant package now uses the latest Ubuntu LTS – Xenial – as it’s build. It also makes some changes to the environment, including, we now use mariadb instead of the now rather defunct (and in some cases broken) Oracle mysql server. The build also now runs PHP 7.0.
If you’re like me, you might need to update your version of vagrant and VirtualBox in order to successfully boot the newer Ubuntu images, so be sure you do that.
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.
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.
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:
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:
dirname(__FILE__) . '/languages/'