forked from off-topic/apps.apple.com
init commit
This commit is contained in:
15
shared/localization/src/setHTMLAttributes.ts
Normal file
15
shared/localization/src/setHTMLAttributes.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user