且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5 Carbon全球语言环境

更新时间:2023-11-17 18:34:40

所以这很糟糕,Carbon实际上正在使用php

So this is my bad, Carbon is actually using the php

setlocale();

the

Carbon::setLocale('fr')

方法仅适用于

->diffForHumans()

方法. 请注意,php setlocale()对存储在您的操作系统上的语言环境的引用 选择已安装的一种用途

method. Notice that the php setlocale() reference to the locale stored on your OS to choose one of the installed one use

locale -a

在控制台上

第二,您必须使用

->formatLocalized()

方法代替

->format()

方法

最后是所有有用的方法,例如

and lastly all the usefull methods like

->toDateString()
->toFormattedDateString()
->toTimeString()
->toDateTimeString()
->toDayDateTimeString()

未本地化

最后,您必须使用这些解析字母

and lastly you have to use these parsing letters

http://php.net/manual/en/function.strftime.php