mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-28 11:30:56 +00:00
718 B
718 B
WebAppLocalizer
Quick reference for AI-assisted development of the WebAppLocalizer class.
Import
<script src="/lollms_assets/js/web.app.localizer"></script>
Initialization
const localizer = new WebAppLocalizer(translations, localStoragePrefix, languageSelector);
Key Methods
setLanguage(lang)
getCurrentLanguage()
getAvailableLanguages()
translate(key)
apply()
Translations Object Structure
{
[langCode]: {
name: "Language Name",
translations: {
[key]: "Translation"
}
}
}
HTML Usage
<element data-translate="key"></element>
Apply translations: localizer.apply();