@@ -4,7 +4,7 @@ import localeData from 'dayjs/plugin/localeData';
44import LocalizedFormat from 'dayjs/plugin/localizedFormat' ;
55import relativeTime from 'dayjs/plugin/relativeTime' ;
66import updateLocale from 'dayjs/plugin/updateLocale' ;
7- import i18n , { TFunction } from 'i18next' ;
7+ import i18n , { FallbackLng , TFunction } from 'i18next' ;
88
99import enTranslations from '../i18n/en.json' ;
1010import frTranslations from '../i18n/fr.json' ;
@@ -181,6 +181,16 @@ type Options = {
181181 translationsForLanguage ?: typeof enTranslations ;
182182} ;
183183
184+ type I18NextConfig = {
185+ debug : boolean ;
186+ fallbackLng : false | FallbackLng ;
187+ interpolation : { escapeValue : boolean } ;
188+ keySeparator : false | string ;
189+ lng : string ;
190+ nsSeparator : false | string ;
191+ parseMissingKeyHandler : ( key : string ) => string ;
192+ } ;
193+
184194/**
185195 * Wrapper around [i18next](https://www.i18next.com/) class for Stream related translations.
186196 * Instance of this class should be provided to Chat component to handle translations.
@@ -375,15 +385,7 @@ export class Streami18n {
375385 currentLanguage : string ;
376386 DateTimeParser : typeof Dayjs | typeof moment ;
377387 isCustomDateTimeParser : boolean ;
378- i18nextConfig : {
379- debug : boolean ;
380- fallbackLng : false ;
381- interpolation : { escapeValue : boolean } ;
382- keySeparator : false ;
383- lng : string ;
384- nsSeparator : false ;
385- parseMissingKeyHandler : ( key : string ) => string ;
386- } ;
388+ i18nextConfig : I18NextConfig ;
387389
388390 /**
389391 * Constructor accepts following options:
@@ -411,7 +413,10 @@ export class Streami18n {
411413 *
412414 * @param {* } options
413415 */
414- constructor ( options : Options = { } ) {
416+ constructor (
417+ options : Options = { } ,
418+ i18nextConfig : Partial < I18NextConfig > = { } ,
419+ ) {
415420 const finalOptions = {
416421 ...defaultStreami18nOptions ,
417422 ...options ,
@@ -471,6 +476,7 @@ export class Streami18n {
471476
472477 return key ;
473478 } ,
479+ ...i18nextConfig ,
474480 } ;
475481
476482 this . validateCurrentLanguage ( ) ;
0 commit comments