New with 0.12.4: Moment.locale() sticks at “en” even when I switch Obsidian to another language

After it has been archived to the bug graveyeard within a few minutes, I copy my post into here, asking for some friendly help or debugging advice:

Steps to reproduce

Open a console, enter moment.locale().

Since 0.12.4 this sticks at “en”, whatever language I choose in Obsidian.

It used to show the 2-letter code of whatever Obsidian language was selected in settings—thus the only reliable way (until 012.3) to set correct number formats for output.

Almost all my code that outputs numbers uses

number.toLocaleString(moment.locale(), {maximumFractionDigits: 1})

and is now broken.

I already disabled all community plugins and CSS snippets one-by-one to find the cause, because it seems to work in the old help vault. (Does that ever get updated?)

I cannot use navigator.language, because that always sticks with OS’s language setting (“de”). And I have to switch between English and German and other languages a lot.

I’m at a loss, any help/bug checks/debugging suggestions welcome!

Expected result

moment.locale() (and ideally also navigator.language) reflecting the language Obsidian is currently set to.

Needed for multilingual people, for writing (and checking) notes in other languages, for bug reports and instructional material, etc.

Actual result

moment.locale() sticks to “en”, navigator.language to “de”.

Environment

  • Operating system: Linux Mint 20.1, Ubuntu 14.04.5 for retro-testing
  • Obsidian version: 0.12.4, installer 0.12.4

Additional information

I did disable all plugins, but should any plugin author read this, please comment if you modify moment’s locale!

FWIW, I’m usually using (worked until 0.12.3):

  • the default theme, light
  • Core Plugins:
    • File explorer
    • Search
    • Quick switcher
    • Graph view
    • Backlinks
    • Outgoing links
    • Tag pane
    • Page preview
    • Command palette
    • Daily Notes
    • Templates
    • Outline
    • Word count
    • Slides
    • Audio recorder
    • Open in default app
    • File recovery
  • Community plugins:
    • Advanced tables
    • Better word count
    • Copy button for code blocks
    • Dangling links
    • Dataview
    • Extract highlights
    • Find unlinked files and unresolved links
    • Hotkeys for templates
    • Hotkeys++
    • (Icons)
    • Obsidian Leaflet
    • (Pandoc Plugin)
    • (Pomodoro plugin)
    • Show whitespace
    • Shuffle
    • Sliding panes (Andy’s Mode)
    • Sortable
    • Templater
    • Text snippets

Those in (parentheses) are only enabled for testing—I don’t regularly use these.

Hmm, this seems to still work for me (though, I’m on 0.12.5). Just to double check, are you clicking “relaunch” after changing the language?

Screen Shot 2021-06-14 at 9.30.58 AM

Yep, I sure did. Just tried it again with 0.12.10, and it’s still the same: Works in the Help Vault but not in mine.

If ever I find the time, I’ll have to investigate more deeply, my fear is that really one of the plugins might modify or override this.

A good alternative (if anyone knows one?) might be to find the place where Obsidian stores that info and simply use that …

Do you use the calendar plugin? Because you can set the locale there/it might be set there.

No, I don’t use Calendar, but thanks for the hint.

SOLVED: I finally found the miscreant: It’s the Obsidian Pomodoro Plugin that globally sets moment’s language to en, thus disabling other plugins’ and my Dataview code’s functionality (like Dictionary).

Related: 'Pronunciation' and 'Meanings' not translated · Issue #16 · phibr0/obsidian-dictionary · GitHub

2 Likes