Files
apps.apple.com/shared/localization/src/setHTMLAttributes.ts
2025-11-04 05:03:50 +08:00

16 lines
456 B
TypeScript

import { getLocAttributes } from './getLocAttributes';
/**
* sets Language attributes to HTML tag.
* @param {string} language
* @returns {void}
*/
export function setHTMLAttributes(language: string): void {
if (typeof window === 'undefined') return;
const attributes = getLocAttributes(language);
for (let [attribute, value] of Object.entries(attributes)) {
window.document.documentElement.setAttribute(attribute, value);
}
}