Php Silverstripe fluent集语言环境

Php Silverstripe fluent集语言环境,php,cron,silverstripe,fluent,Php,Cron,Silverstripe,Fluent,下午好 有人知道是否有一种方法可以设置语言环境手册吗?我想通过cronjob更新数据库中一些基于区域设置的项目,但为了使其正常工作,我必须根据一些变量而不是服务器的区域设置来设置区域设置。在SilverStripe 3版本的Fluent中,您可以使用Fluent::with_locale在给定区域设置的上下文下执行回调,例如: Fluent::with_locale('de_DE', function () { $myObject = MyObject::create(); $m

下午好


有人知道是否有一种方法可以设置语言环境手册吗?我想通过cronjob更新数据库中一些基于区域设置的项目,但为了使其正常工作,我必须根据一些变量而不是服务器的区域设置来设置区域设置。

在SilverStripe 3版本的Fluent中,您可以使用
Fluent::with_locale
在给定区域设置的上下文下执行回调,例如:

Fluent::with_locale('de_DE', function () {
    $myObject = MyObject::create();
    $myObject->Title = 'German title';
    $myObject->write();
});
作为参考,在SilverStripe 4版本中,您可以执行以下操作:

FluentState::singleton()->withState(function (FluentState $newState) {
    $newState->setLocale('de_DE');
    // ...
});

在SilverStripe 3版本的Fluent中,您可以使用
Fluent::with_locale
在给定语言环境的上下文下执行回调,例如:

Fluent::with_locale('de_DE', function () {
    $myObject = MyObject::create();
    $myObject->Title = 'German title';
    $myObject->write();
});
作为参考,在SilverStripe 4版本中,您可以执行以下操作:

FluentState::singleton()->withState(function (FluentState $newState) {
    $newState->setLocale('de_DE');
    // ...
});

您使用的是什么SilverStripe/Fluent版本?SilverStripe 3.3您使用的是什么SilverStripe/Fluent版本?SilverStripe 3.3