Internationalisation
Saturn provides full support for multilingual applications. Database schema automatically generates columns for multiple languages, and queries are translated transparently. Translation in routes and views can be implemented with the global l() function. This function takes an associative array as argument, returning the value corresponding to the current language.
<h1><?= l([
'en' => 'News',
'nl' => 'Nieuws',
'fr' => 'Nouvelles',
]) ?></h1>
public static function route($router)
{
$router->get(l([
'en' => 'news',
'nl' => 'nieuws',
'fr' => 'nouvelles',
]), 'index');
}
Language files
An alternative way of using the l() function is by using language files. Create a folder named languages alongside your controller, and add a txt file with a language identifier as filename. In this file you can add translatable strings, each one on a new line containing name and value, separated by an equals sign. You can then call the l() function with just the name of the translatable string as parameter.
News = Nieuws
news = nieuws
Page = Pagina
No news at this time = Momenteel geen nieuws
<h1><?= l('News') ?></h1>