javascript - 如何将月份名称英语更改为阿拉伯语
问题描述
在我的 codepen 链接下方,我有事件日历,它直接获取英文月份,但我想将其月份名称更改为阿拉伯语
例如:二月需要更改为“فبراير”
Codepen 链接:点击这里
$('.b-calendar__header .month').each(function() {
var text = $(this).text();
$(this).text(text.replace('February', 'فبراير'));
});
我试过这种方式但不工作
请帮忙
解决方案
我希望这对你有用
const formatter = new Intl.DateTimeFormat('ar', { month: 'short' });
const month1 = formatter.format(new Date());
console.log(month1);
推荐阅读
- python - 如何有效地将这段代码实现到这个 GUI 中?(我对编码有点陌生)只是要求一个一般的想法或提示
- caliburn.micro - 无法构建 Caliburn.Micro 解决方案
- android - 没有Android studio的Android SDK报错“Error: Unable to find or load the main class Files\Android\tools\bin\\”
- python - 与卷积的中心差异
- reactjs - 在数据系列单击、Highcharts/React 上更改 xAxis 标签样式
- r - R函数帮助仅获取唯一值,然后获取基本指标
- c - 用行矩阵填充 char[] 并遍历所有行
- react-native - Fetch 不适用于 HTTP 请求(移动客户端 - React Native 和服务器 - Java)
- javascript - 从服务器播放视频作为 blob url
- r - 有没有一种方法可以将多项式或多项式的系数存储在 R 向量的单个元素中?