我的安装:
拼写错误3 12.4.11
新闻11.4.1
PHP 8.2.15
我想覆盖此语言文件中的月份名称: typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf
例如,我尝试将一月更改为 Jannewaris,以创建:“01 Jannewaris 2024”作为新闻项日期。 无论我尝试什么,我都做不到。
我的设置中有这个,它确实有效:plugin.tx_news._LOCAL_LANG.da.dateFormat = %d %B -%Y。
它拼写月份名称(2024 年 1 月 1 日)而不是显示 01.01.2024,但我想用“Jannewaris”更改一月的拼写
例如我尝试更改month.01 我在文件中更改了一月的名称:typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf 如下图。
<trans-unit id="month.01" xml:space="preserve" approved="yes">
<source>January</source>
<target state="final">Jannewaris</target></trans-unit>
上面的代码不会将一月更改为Jannewaris,仍然显示丹麦语的正确拼写。 我在以下位置使用以下代码块:Partials/List/list.html
<time itemprop="datePublished" class="event-fa-time" datetime="{f:format.date(date:newsItem.datetime, format:'Y-m-d')}">
<f:format.date format="{f:translate(key:'dateFormat')}" >{newsItem.datetime}</f:format.date></time>
在 TS 设置中,我尝试使用此脚本:plugin.tx_news._LOCAL_LANG.da.month.01 = Jannewaris
也没有任何效果。我仍然无法将文本更改为 Jannewaris
如何更改月份的拼写?
Typo3 / tx_news 从哪里获取月份名称?
如果我删除文件:typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf da 语言前端仍然显示月份。
谁能告诉我这是怎么做到的? 我不知道 Typo3 如何/在哪里生成月份名称?
谢谢。
如果您使用 PHP 函数
strftime()
(如果您使用像 %d %B -%Y
这样的格式就是这种情况),月份的名称来自操作系统。要获得匹配的拼写,您需要配置匹配的区域设置。locale -a
获取可用语言环境列表。
如果您想使用您的语言字符串,您需要自己“翻译”它:
获取月份并将其用作翻译密钥:
<f:translate key="month.{f:format.date(format:'m', base:newsItem.datetime)}">