Date:
26 Feb 2011
Category:
Development Notes
Discuss:
1 comment

Imagine for a moment that many years ago, a small group of Bavarians—Albrecht, Adalbert and Sigismund (they all have funny accents)—created an XML-based content management system called "Synfonie". You really like it because of its simplicity, its use of web standards and because of the possibilities it opens to your own web design and development process. The only problem is: the whole interface is written in German.

You think, "Ok, I tool one year of German in school. That should do the trick." But with your first client project you notice that those who will edit your website, who will have to deal with the interface in their day-to-day life, don't understand German that well at all. What was that word for "remove item"? Ah, yes, right: entfernen.

This is where localisation enters the stage.

Symphony introduced its first localisation features soon after the release of Symphony 2.0. In Symphony 2.2 we revised the system to make localisation more logical and consistent.

Changes

In earlier versions of Symphony, translations were available in the "Language" section of the system preferences as soon as a single extension offered translated strings for that language. This was quite confusing for the user because when he switched to that language only the strings provided by the extension were translated. This looked like a bug.

Symphony 2.2 streamlines the core's language management, and bases the list of available languages on the availability of core translations. In other words: if there is no core translation, a language is not selectable. Furthermore, language extensions now need to be enabled to be visible to the system and selectable in the preferences.

Developing for an international audience

The implementation of Symphony’s language management has changed:

  • To get the currently activated language, use Lang::get(). The previously available function Symphony::Lang() has been removed due to issues with the installer.
  • To load a language, use Lang::set('code'), where code represents the language (e. g. en, de, it etc.).
  • To get a list of all selectable languages (those that are enabled and provide core translation), use Lang::getAvailableLanguages(). If you don’t want to check the extension status pass an optional false: Lang::getAvailableLanguages(false).
  • To get information about all languages files, use Lang::$_languages.
  • To see if the system has been localised, use Lang::isLocalized()
  • The implementation translation function (__()) has not been changed. The function Lang::getBrowserLanguages() has been removed in Symphony 2.2.

Date Localisation

Symphony now properly localises dates:

  • To localise a date use Lang::localizeDate($string)
  • To get a standardised (english) date use Lang::standardizeDate($string)
  • Furthermore it’s now possible to specify a custom date and time separator in the configuration. By default it’s using a single space:
       ###### REGION ######
       'region' => array(
               'time_format' => 'H:i',
               'date_format' => 'd F Y',
               'datetime_separator' => ' ',
               'timezone' => 'Europe/Berlin',
       ),
       ########

End of Chapter

Although the Bavarians are not always sure why things should be translated and how come two German words can turn into one in English, all English speaking "Sinfonie" users will be happy to have an interface using their mother's tongue (unless their mother spoke some strange language with words like "arvo" and "mozzies"). So developers should have a closer look at their extensions while reading more about translating Symphony.

Comments

Got a very informative post about Symphony 2.2. Searching for some relevant stuff and it's well enough satisfying.

Pressure cleaning roof Margate

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details