ExpressionEngine 7.5 has been Released! Learn More!
How do i translate entry date strings?
Tue 16 Jan 2024 (EN) needs to become di 16 jan 2024 (NL) I want to translate the days and months, what would be the most elegant way to do this? I did it before with JavaScript but if anyone else has a different solution I’d love to hear it. Thanks!
There are a number of ways to approach this, but the standard native approach to translating EE system output words/phrases is via Language files/packs.
In system/ee/languages/ there is the default English file, that contains all of the system words and phrases EE outputs. That applies to frontend and backend system generated content.
You should never edit/add files in system/ee - they could be replaced. But, you can edit the english language words or add additional languages in system/user/language/. Each language should have its own folder. If you put an english folder in there, you can override the default english version. You can even just put a single file- that file will override the default, and it will fall back to the default files.
You can add more languages by adding folders containing translated versions of the files. And you can select which folder/language the file uses as the default in the settings. Logged in members can choose their own language preferences from the options available.
You can download user created language packs from the github repo or use the Translator utility to make/edit your own.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.