碳排放场所不受尊重吗? [英] Carbon locale not respected?

查看:72
本文介绍了碳排放场所不受尊重吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Laravel 6应用中,我有 Carbon :: now()-> locale()按原样返回 it .

In my Laravel 6 app, I have Carbon::now()->locale() returning it as it should be.

为确认已加载语言环境, Carbon :: now()-> monthName 正确输出 febbraio .

As confirmation that the locale is loaded, Carbon::now()->monthName correctly outputs febbraio.

Carbon :: now()-> format('F') Carbon :: now()-> formatLocalized('%B')都返回英文版本 February .

为什么第一个函数不能输出正确的本地化月份,而其他函数却不能输出?

Why does the first function output the correct localized month while the others do not?

推荐答案

显然, formatLocalized()已过时或不按预期运行.

Apparently, formatLocalized() is somehow deprecated or not working as intended.

来自Carbon文档:

From the Carbon docs:

您也可能从Carbon 1中知道formatLocalized()方法.此方法在Carbon 2中仍然有效,但是您最好改用isoFormat().

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')正在按预期工作,并正确返回了 febbraio .

Carbon::now()->isoFormat('MMMM') is working as intended and correctly returns febbraio.

这篇关于碳排放场所不受尊重吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆