osama7901 osama7901 - 1 year ago 97
PHP Question

Silverstripe i18n collecting translations in the templates only creates en.yaml?

I am building a site that uses ar and en languages, and according to the silverstripe docs here, I did the text collection process and went successful. but only one en.yaml file is created in the lang folder in my current theme. there should be another ar.yaml file!.

here's my _config.php file:


global $project;
$project = 'mysite';


global $databaseConfig;
$databaseConfig = array(
'type' => 'MySQLDatabase',
'server' => 'localhost',
'username' => 'dbuser',
'password' => '123',
'database' => 'cont_learning_2',
'path' => ''

// Set the site locale


if(!Director::isDev()) {
// log errors and warnings
SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors-warnings.log'), SS_Log::WARN, '<=');

// or just errors
SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors.log'), SS_Log::ERR);

// or notices (e.g. for Deprecation Notifications)
SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors-notices.log'), SS_Log::NOTICE);


// multi-language configuration - translatable module

wmk wmk
Answer Source

Using https://github.com/Zauberfisch/silverstripe-better-i18n you are able to create and update different languages in one task. You can install it with composer as a development-only requirement.

I run it like


to create german and english yml files in mysite and themes/my-theme.

It will create a bunch of items prefixed with double underscore (as pseudo comments) and also the default keys for your database fields.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download