Allow specifying date locale for Templates and Daily Notes

Use case or problem

I use Obsidian for notes of multiple languages, and some of my notes are in English, while others are in German. I set Obsidian’s main language to English, but I would like for some notes (my daily notes, specifically) to display the date they were created on, but with the German words for weekdays and months.

Proposed solution

I think there are two solutions that would work for this problem, one of which is a lot less versatile.

  1. Add a “date locale” or “date language” option to the Templates and Daily Notes core plugins, which would change the locale of every date used by either plugin
  2. Add a custom way of formatting dates and including the locale you want the date to display with. Something like {{date:dddd, MMMM D, YYYY:de}}, for example.
5 Likes

That is exactly the problem I like to solve at the moment. The link to the moment.js documentation did not help that much. Using {{date:LLLL}} gets you half the way. But I would love to get rid of the time and just have the date in German.

1 Like

I believe I have a similar issue. I just set up my daily note name top include [ddd]. On my iphone the name given to the file is [tue] (set to English with Swedish locale/date/time)

On my windows11 box I get [tis]. since I am using Sync I get 2 different files 8(.
Windows box is also set to English language but Swedish locale.

I’m not quite sure if this is the same issue discussed, if anyone have any other pointers; would be much appreciated.

/Richard

@Ellpeck A workaround would be to use the calendar plugin to set the moment locale to German. That will be global, but should only be used in templates and daily notes anyway, unless I’m missing something.

8 Likes

Oh cool this works! I can now use stuff like {{date:dddd D MMMM YYYY}} and it will use Dutch locale

Thank you, the only solution that worked for me.
However, the implementation proposed by @Ellpeck should be nice in order to able to manage notes in different languages which is my case.

pour les français, la solution est dans le override locale et la selection du " fr " du plugin calendar. Dans “advanced settings”

1 Like

Worked like a miracle. Thank you!

Duplicates:

Templater solution:

<%* 
const d = new Date();
let text1 = d.toLocaleString("en-US");
let text2 = d.toLocaleString("en-UK");
tR += text1.concat("\n", text2);
%>

It would be helpful if this would be possible without relying on community plugins. I prefer to only use core plugins. I do think @Ellpeck’s proposed solutions would be really helpful to add if that’s possible.

Any updates on this? I also have the exact same issue. I set moment.locale(“de”) in my Root file (the one I view at startup) but if I ever not open the file when I start my vault and I create a daily, I get english Day names. I use this daily template:

tag: daily
date: <% tp.date.now("DD.MM.YYYY") %>
---
....

Have you used Calendar plugin to override locale setting (Allow specifying date locale for Templates and Daily Notes - #7 by levenitian)?

No, I don’t want to use a second plugin only for this

For whatever reason, the calendar plugin is not syncing locale settings to android - or at least not overriding the global settings for locale in android.

Meaning that when I open a daily-note through my phone it’s “Tuesday”, and on computer it’s whatever my desired locale is. Makes it quite annoying to orient around when naming is inconsistent.

Please address this