MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / getSystemUILocale

Method getSystemUILocale

src/main.ts:250–268  ·  view source on GitHub ↗

* Get the system UI locale with proper priority order for TaskNotes plugin. * * Priority order for "System default" language setting: * 1. Obsidian's configured language (what users expect for plugin behavior) * 2. Browser/system locale (fallback if Obsidian language unavailable) * 3. Engl

()

Source from the content-addressed store, hash-verified

248 * for an Obsidian plugin.
249 */
250 private getSystemUILocale(): string {
251 // Priority 1: Get Obsidian's configured language (this is what users expect!)
252 try {
253 const obsidianLanguage = getLanguage();
254 if (obsidianLanguage) {
255 return obsidianLanguage;
256 }
257 } catch {
258 // Silently continue to next attempt if getLanguage() fails
259 }
260
261 // Priority 2: Fall back to browser/system locale
262 if (typeof navigator !== "undefined" && navigator.language) {
263 return navigator.language;
264 }
265
266 // Priority 3: Ultimate fallback
267 return "en";
268 }
269
270 private refreshLocalizedViews(): void {
271 // Views source their labels via getDisplayText; they'll pick up translations on next refresh.

Callers 1

onloadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected