Skip to content

Commit

Permalink
fix: extra lang section typing
Browse files Browse the repository at this point in the history
  • Loading branch information
paring-chan committed Mar 20, 2024
1 parent c7fdbab commit ccab527
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/lib/utils/translation-constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare global {
namespace ADOFAIGG_UI {
type ExtraLangSections = []
}
}

export {}
3 changes: 1 addition & 2 deletions src/lib/utils/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ export const availableLanguages: LangResponse[] = langs

export const fallbackLang = 'en'

export type ExtraLangSections = []
const registeredLangSections: string[] = []

const langSections = ['common', 'footer', 'nav'] as const

export type LangSection = (typeof langSections)[number] | ExtraLangSections[number]
export type LangSection = (typeof langSections)[number] | ADOFAIGG_UI.ExtraLangSections[number]
export type LangData = Record<string, FluentBundle>
// eslint-disable-next-line @typescript-eslint/ban-types
export type StringTranslationKey = `${LangSection}:` | (`${LangSection}:${string & {}}` & {})
Expand Down

0 comments on commit ccab527

Please sign in to comment.