Blesta version 6 has been released! Read More.
All posts
Developer Corner 2011-09-23 · Cody · 2 min read

Blesta 3.0: Smarter i18n

Smarter internationalization in Blesta 3.0: per-controller and per-model language files, improved syntax with placeholders, fallback support, and translatable extensions.

i18n, or internationalization, is the process of adapting software to be deployed around the world. Since version 1.0 we’ve dedicated a large portion of our time to making Blesta an international product. And in version 3 we’ve gone even further by enhancing our multi-language support.

To start, you’ll notice language definitions are now diffused across multiple files. This serves two purposes. First, it promotes congruency between objects and their associated language (each Controller and Model has its own language file). Secondly, it allows us to load only content that is relative to the resource being requested. This saves memory, speeds up load times, and makes development much easier.

Syntax support has also been greatly improved. Previous versions supported tag replacement, but many phrases and sentences were graphed or concatenated together. This meant that some translations were left with incorrect syntax or awkward phrasing. We were able to do away with that thanks to minPHP‘s Language support.

Here’s an example, flashing a success message after having saved a staff group:

<?php
// Success
$this-&gt;flashMessage("message", Language::_("AdminSystemStaff.!success.group_updated", true, $this->post['name']));
$this-&gt;redirect($this-&gt;base_uri . "settings/system/staff/groups/");
?>

Here’s the related language definition:

$lang['AdminSystemStaff.!success.group_updated'] = "The staff group, %1$s, has been successfully updated!";

And the visual result:

In addition, version 3 offers automatic fall-back language support in the case of missing definitions.

And finally, we’re introducing translation support for modules, gateways, plugins, and widgets. Everything is translatable. Let’s see how long it takes the competition to catch on.

30-day free trial · No credit card · Your server

Read enough. Run it.

Everything on this blog ships in the box. Full product, free for 30 days, on your own server.

Download  6.0.0