Revert "we call update() manualle through registerTranslation() at the moment, so no need to observe the 'lang' attribute"
This reverts commit 6f07663e8f78147d0cfce0c4b25fb3bfc4978c86.
This commit is contained in:
@@ -26,17 +26,17 @@ export interface DefaultTranslationSet extends TranslationSet {
|
||||
}
|
||||
|
||||
export const connectedElements = new Set<HTMLElement>();
|
||||
// const documentElementObserver = new MutationObserver(update);
|
||||
const documentElementObserver = new MutationObserver(update);
|
||||
export const translations: Map<string, TranslationSet> = new Map();
|
||||
export let documentDirection = document.documentElement.dir || 'ltr';
|
||||
export let documentLanguage = document.documentElement.lang || navigator.language;
|
||||
export let fallback: TranslationSet;
|
||||
|
||||
// Watch for changes on <html lang>
|
||||
// documentElementObserver.observe(document.documentElement, {
|
||||
// attributes: true,
|
||||
// attributeFilter: ['lang'],
|
||||
// });
|
||||
documentElementObserver.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ['dir', 'lang'],
|
||||
});
|
||||
|
||||
/** Registers one or more translations */
|
||||
export function registerTranslation(...translation: TranslationSet[]) {
|
||||
|
||||
Reference in New Issue
Block a user