diff options
| author | Joe Carstairs <65492573+joeacarstairs@users.noreply.github.com> | 2025-01-08 19:06:59 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 19:06:59 +0000 |
| commit | 7c9e28c1f614cbab7f84344be840e9aec0bc194c (patch) | |
| tree | 205afc5e3b411bd2ee84b83287307b2deb4d4192 /src/lib/correctLocaleCasing.ts | |
| parent | 9fb9e47e92049b72cdc7cbaa3e9d43ed1aacd095 (diff) | |
| parent | 7e0219994b0f62b7d17310f5adebb549e129c952 (diff) | |
Merge pull request #110 from joeacarstairs/staging
Update
Diffstat (limited to 'src/lib/correctLocaleCasing.ts')
| -rw-r--r-- | src/lib/correctLocaleCasing.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/correctLocaleCasing.ts b/src/lib/correctLocaleCasing.ts new file mode 100644 index 0000000..4a0f669 --- /dev/null +++ b/src/lib/correctLocaleCasing.ts @@ -0,0 +1,13 @@ +import locales from '$i18n/locales'; + +export function correctLocaleCasing(str: string) { + const strLowercase = str.toLowerCase(); + + for (const locale of locales) { + if (strLowercase === locale.toLowerCase()) { + return locale; + } + } + + return str; +} |
