many updates
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
const map: Record<string, string> = {
|
||||
'en': 'us',
|
||||
}
|
||||
|
||||
const localeMapper = (locale: string) => {
|
||||
return Object.keys(map).includes(locale) ? map[locale] : locale
|
||||
}
|
||||
|
||||
export {
|
||||
localeMapper
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
export {};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
plugi: Record<string, unknown>;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,15 @@
|
||||
import './style.css'
|
||||
// import typescriptLogo from './typescript.svg'
|
||||
import Alpine from 'alpinejs'
|
||||
import {localeMapper} from "./helpers/localemapper.ts";
|
||||
|
||||
|
||||
const getFlagEmoji = (locale: string)=> {
|
||||
const countryCode = localeMapper(locale)
|
||||
return String.fromCodePoint(...[...countryCode.toUpperCase()].map(x=>0x1f1a5+x.charCodeAt(0)))
|
||||
}
|
||||
|
||||
window.plugi = {}
|
||||
window.plugi.getFlagEmoji = getFlagEmoji
|
||||
|
||||
Alpine.start()
|
||||
|
||||
Reference in New Issue
Block a user