My installation:
TYPO3 12.4.11
News 11.4.1
PHP 8.2.15
I want to overwrite the months names in this language file:
typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf
For example, I try to change January to Jannewaris to create: 01 Jannewaris 2024 for the news item date.
No matter what I try I cannot do it.
I have this in my setup, it does work:
plugin.tx_news.\_LOCAL_LANG.da.dateFormat = %d %B -%Y.
It spells the name of the month (01 January 2024) instead of displaying 01.01.2024, but I want to change the spelling from January with Jannewaris.
For example I try to change month.01
I change the name for January in the file: typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf
as shown below.
<trans-unit id="month.01" xml:space="preserve" approved="yes">
<source>January</source>
<target state="final">Jannewaris</target>
</trans-unit>
The above code does not change January to Jannewaris, the correct spelling for danish is still shown.
I use the below block of code in: 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>
In TS Setup I have tried using this script:
plugin.tx_news.\_LOCAL_LANG.da.month.01 = Jannewaris
It does not have any effect either. I still cannot change the text to Jannewaris
How do I make a change to the spelling of the month?
Where does TYPO3 / tx_news get the month names from?
If I remove the file typo3conf/l10n/da/news/Resources/Private/Language/da.locallang.xlf the months are still displayed on the front-end for the da language.
Can anyone tell me how is it done? I have no idea how / where Typo3 is generating the month names?
Thanks.
if you use the PHP function
strftime()(which is the case if you use a format like%d %B -%Y) the name of the month comes from the operating system. To get the matching spelling you need to configure the matching locale setting.Get the list of available locales by
locale -afrom the command line.If you want to use your language strings you need to 'translate' it on your own:
Get the number of the month and use it for the translation-key:
<f:translate key="month.{f:format.date(format:'m', base:newsItem.datetime)}" />EDIT:
you could define a partial/section for it: