-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add support for accessible locales with `@openkit/languag…
…e-codes`
- Loading branch information
Showing
5 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'x-boilerplate': minor | ||
--- | ||
|
||
add support for accessible locales with `@openkit/language-codes` |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import type { En, EsMX } from '@openkit/language-codes'; | ||
import localeCulture from '@openkit/language-codes'; | ||
|
||
import locales from '@/libs/i18n/locales'; | ||
|
||
export type Language = { | ||
key: keyof typeof locales; | ||
dir?: 'ltr' | 'rtl'; | ||
fontScale?: number; | ||
// https://gist.github.com/JamieMason/3748498 | ||
specCulture?: 'en-US' | 'es-MX'; | ||
specCulture?: En['culture'] | EsMX['culture']; | ||
}; | ||
|
||
export const DEFAULT_NAMESPACE = 'common'; | ||
|
||
export const DEFAULT_LANGUAGE_KEY: Language['key'] = process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE_KEY ?? 'en'; | ||
export const DEFAULT_LANGUAGE_KEY: Language['key'] = | ||
process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE_KEY ?? localeCulture.EN.folderName; | ||
|
||
export const AVAILABLE_LANGUAGES: Language[] = [ | ||
{ | ||
key: 'en', | ||
specCulture: 'en-US', | ||
key: localeCulture.EN.folderName, | ||
specCulture: localeCulture.EN.culture, | ||
}, | ||
{ | ||
key: 'es_mx', | ||
specCulture: 'es-MX', | ||
key: localeCulture.ES_MX.folderName, | ||
specCulture: localeCulture.ES_MX.culture, | ||
}, | ||
]; |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7ee7c13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
x-boilerplate – ./
x-boilerplate-codea.vercel.app
x.openkit.run
x-boilerplate-git-main-codea.vercel.app
x-boilerplate-demo.wootsbot.dev