many updates

This commit is contained in:
Paul Spenke
2023-07-10 21:27:43 +08:00
parent 249f6b06b5
commit cd9dc85420
29 changed files with 3164 additions and 962 deletions
@@ -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
}
+7
View File
@@ -0,0 +1,7 @@
export {};
declare global {
interface Window {
plugi: Record<string, unknown>;
}
}
+13
View File
@@ -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()