You've already forked obsidian-visualiser
Mass updates
This commit is contained in:
@@ -4,7 +4,25 @@ import type { Localized } from "~/types/general";
|
||||
|
||||
const config = characterConfig as CharacterConfig;
|
||||
|
||||
export function getText(id?: i18nID, lang?: keyof Localized): string
|
||||
let language: keyof Localized = 'fr_FR';
|
||||
export function init()
|
||||
{
|
||||
return id ? (config.texts.hasOwnProperty(id) ? (config.texts[id] as Localized)[lang ?? "default"] ?? '' : '') : '';
|
||||
language = localStorage.getItem('language') as keyof Localized ?? 'fr_FR';
|
||||
}
|
||||
export function setLang(lang: keyof Localized)
|
||||
{
|
||||
localStorage.setItem('language', lang);
|
||||
language = lang;
|
||||
}
|
||||
export function getText(id?: i18nID): string
|
||||
{
|
||||
if(!id) return '';
|
||||
if(!config.texts.hasOwnProperty(id)) return '';
|
||||
if(!config.texts[id]!.hasOwnProperty(language)) return 'Untranslated';
|
||||
else return config.texts[id]![language]!;
|
||||
}
|
||||
export function setText(id: i18nID, text: string)
|
||||
{
|
||||
if(!config.texts.hasOwnProperty(id)) config.texts[id] = {};
|
||||
config.texts[id]![language] = text;
|
||||
}
|
||||
Reference in New Issue
Block a user