@@ -21,7 +21,7 @@ export class I18NextService {
21
21
private i18nextPromise : Promise < void > ;
22
22
23
23
public use ( plugin : Function ) {
24
- i18next . use ( plugin ) ;
24
+ i18next . use . call ( i18next , plugin ) ;
25
25
return this ;
26
26
}
27
27
@@ -32,7 +32,7 @@ export class I18NextService {
32
32
33
33
return this . i18nextPromise =
34
34
new Promise < void > ( ( resolve : ( thenableOrResult ?: void | Promise < void > ) => void , reject : ( error : any ) => void ) => {
35
- i18next . init ( Object . assign ( { } , options ) ,
35
+ i18next . init . call ( i18next , Object . assign ( { } , options ) ,
36
36
( err : any ) => {
37
37
if ( err ) {
38
38
console . error ( err ) ;
@@ -47,14 +47,14 @@ export class I18NextService {
47
47
48
48
public t ( key : string | string [ ] , options ?: any ) : string {
49
49
options = options || { } ;
50
- return i18next . t ( < any > key , options ) ;
50
+ return i18next . t . call ( i18next , < any > key , options ) ;
51
51
}
52
52
53
53
public changeLanguage ( lng : string ) : Promise < i18next . TranslationFunction > {
54
54
return new Promise < i18next . TranslationFunction > (
55
55
( resolve : ( thenableOrResult ?: i18next . TranslationFunction ) => void ,
56
56
reject : ( error : any ) => void ) => {
57
- i18next . changeLanguage ( lng , ( err , t ) => {
57
+ i18next . changeLanguage . call ( i18next , lng , ( err , t ) => {
58
58
if ( ! err )
59
59
resolve ( t ) ;
60
60
else
@@ -65,14 +65,14 @@ export class I18NextService {
65
65
}
66
66
67
67
private subscribeEvents ( ) {
68
- i18next . on ( 'initialized' , e => {
68
+ i18next . on . call ( i18next , 'initialized' , e => {
69
69
this . language = i18next . language ;
70
70
this . languages = i18next . languages ;
71
71
this . events . initialized . next ( ! ! e ) ;
72
72
} ) ;
73
- i18next . on ( 'loaded' , e => this . events . loaded . next ( ! ! e ) ) ;
74
- i18next . on ( 'failedLoading' , e => this . events . failedLoading . next ( e ) ) ;
75
- i18next . on ( 'languageChanged' , e => {
73
+ i18next . on . call ( i18next , 'loaded' , e => this . events . loaded . next ( ! ! e ) ) ;
74
+ i18next . on . call ( i18next , 'failedLoading' , e => this . events . failedLoading . next ( e ) ) ;
75
+ i18next . on . call ( i18next , 'languageChanged' , e => {
76
76
this . language = i18next . language ;
77
77
this . languages = i18next . languages ;
78
78
this . events . languageChanged . next ( e ) ;
0 commit comments