Created
February 17, 2022 21:18
-
-
Save ebeloded/df8c72faa9b59f37ca6aebf69f2c0c5b to your computer and use it in GitHub Desktop.
dynamically load languages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.entries(import.meta.glob('../locales/*.yaml')) | |
.map(([path, f]) => [/locales\/(.+?)\.yaml/.exec(path)?.[1], f] as any) | |
.forEach(([key, f]) => { | |
console.log({ key, f }) | |
locales[key] = true | |
if (key !== 'en') register(key, f) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment