Carbon 语言环境不被尊重?
Carbon locale not respected?
在我的 Laravel 6 应用程序中,我 Carbon::now()->locale()
returning it
应该是这样。
确认区域设置已加载,Carbon::now()->monthName
正确输出 febbraio
。
但是 Carbon::now()->format('F')
和 Carbon::now()->formatLocalized('%B')
都是 return 英文版 February
。
为什么第一个函数输出正确的本地化月份而其他函数不输出?
显然,formatLocalized()
已被弃用或未按预期工作。
来自 Carbon 文档:
You also may know formatLocalized() method from Carbon 1. This method still works > the same in Carbon 2 but you should better use isoFormat() instead.
Carbon::now()->isoFormat('MMMM')
按预期正常工作 returns febbraio
.
在我的 Laravel 6 应用程序中,我 Carbon::now()->locale()
returning it
应该是这样。
确认区域设置已加载,Carbon::now()->monthName
正确输出 febbraio
。
但是 Carbon::now()->format('F')
和 Carbon::now()->formatLocalized('%B')
都是 return 英文版 February
。
为什么第一个函数输出正确的本地化月份而其他函数不输出?
显然,formatLocalized()
已被弃用或未按预期工作。
来自 Carbon 文档:
You also may know formatLocalized() method from Carbon 1. This method still works > the same in Carbon 2 but you should better use isoFormat() instead.
Carbon::now()->isoFormat('MMMM')
按预期正常工作 returns febbraio
.