1- import i18next , { StringMap , TOptions } from 'i18next' ;
1+ import i18next , { StringMap , TOptions , TFunction } from 'i18next' ;
22import LanguageDetector from 'i18next-browser-languagedetector' ;
33
44import { Stage , Status , FinalType , GroupType , StageType } from 'brackets-model' ;
@@ -8,6 +8,8 @@ import { OriginHint, RoundNameInfo } from './types';
88import en from './i18n/en/translation.json' ;
99import fr from './i18n/fr/translation.json' ;
1010
11+ export type { TFunction } from 'i18next' ;
12+
1113export const locales = {
1214 en,
1315 fr,
@@ -51,8 +53,6 @@ export function t<Scope extends keyof Locale, SubKey extends string & keyof Loca
5153 return i18next . t ( key , options ) ;
5254}
5355
54- export type Translator = typeof t ;
55-
5656export type ToI18nKey < S extends string > = S extends `${infer A } _${infer B } `
5757 ? `${A } -${B } `
5858 : never ;
@@ -235,22 +235,22 @@ export function getBracketName(stage: Stage, type: GroupType): string | undefine
235235/**
236236 * Returns the name of a round.
237237 */
238- export function getRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : Translator ) : string {
238+ export function getRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : TFunction ) : string {
239239 return roundNumber === roundCount ? t ( 'common.round-name-final' ) : t ( 'common.round-name' , { roundNumber } ) ;
240240}
241241
242242// eslint-disable-next-line jsdoc/require-param
243243/**
244244 * Returns the name of a round in the winner bracket of a double elimination stage.
245245 */
246- export function getWinnerBracketRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : Translator ) : string {
246+ export function getWinnerBracketRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : TFunction ) : string {
247247 return roundNumber === roundCount ? t ( 'common.round-name-winner-bracket-final' ) : t ( 'common.round-name-winner-bracket' , { roundNumber } ) ;
248248}
249249
250250// eslint-disable-next-line jsdoc/require-param
251251/**
252252 * Returns the name of a round in the loser bracket of a double elimination stage.
253253 */
254- export function getLoserBracketRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : Translator ) : string {
254+ export function getLoserBracketRoundName ( { roundNumber, roundCount } : RoundNameInfo , t : TFunction ) : string {
255255 return roundNumber === roundCount ? t ( 'common.round-name-loser-bracket-final' ) : t ( 'common.round-name-loser-bracket' , { roundNumber } ) ;
256256}
0 commit comments