@@ -9,6 +9,7 @@ export type TranslationWithArgsOptions<N extends number> = TranslationOptions &
99
1010export type TranslationOptions = {
1111 args ?: string [ ] ;
12+ fallback ?: string ;
1213 prefix ?: string | null ;
1314} ;
1415
@@ -43,25 +44,27 @@ export interface TranslationWithArgs<N extends number> extends TranslationBase {
4344}
4445
4546export default class Translation extends Constant implements TranslationBase {
46- static RECONNECTING = this . Chat ( 'reconnecting' ) ;
47-
4847 static CATEGORY_CHAT_COMMAND = this . Setting ( 'category.chat.commands' ) ;
4948 static CATEGORY_CHAT_IGNORED = this . Setting ( 'category.chat.ignored' ) ;
49+ static CATEGORY_CHAT_IMPORT = this . Setting ( 'category.chat.import' ) ;
5050 static CATEGORY_HOME = this . Setting ( 'category.home' ) ;
5151 static CATEGORY_LIBRARY_CRAFTING = this . Setting ( 'category.library.crafting' ) ;
52+ static CATEGORY_STREAMER = this . Setting ( 'category.streamer' ) ;
5253
5354 static DISABLE_COMMAND_SETTING = this . Setting ( 'disable.command' , 1 ) ;
5455
5556 static DISMISS = this . Toast ( 'dismiss' ) ;
5657 static IGNORE = this . Toast ( 'ignore' , 1 ) ;
57- static UNDO = this . Toast ( ' undo') ;
58+ static UNDO = new Translation ( 'toast. undo', { fallback : 'Undo' } ) ;
5859
5960 static CLOSE = this . Vanilla ( 'dialog-close' ) ;
6061
6162 private args : string [ ] ;
63+ private fallback ?: string ;
6264
6365 constructor ( key : string , {
6466 args = [ ] ,
67+ fallback,
6568 prefix = 'underscript' ,
6669 } : TranslationOptions = { } ) {
6770 if ( prefix ) {
@@ -70,6 +73,7 @@ export default class Translation extends Constant implements TranslationBase {
7073 super ( key ) ;
7174 }
7275 this . args = args ;
76+ this . fallback = fallback ;
7377 }
7478
7579 get key ( ) : string {
@@ -79,6 +83,7 @@ export default class Translation extends Constant implements TranslationBase {
7983 translate ( ...args : string [ ] ) : string {
8084 return translateText ( this . key , {
8185 args : args . length ? args : this . args ,
86+ fallback : this . fallback ,
8287 } ) ;
8388 }
8489
@@ -93,12 +98,12 @@ export default class Translation extends Constant implements TranslationBase {
9398 return this . translate ( ) ;
9499 }
95100
96- static Chat ( key : string ) : Translation ;
97- static Chat < N extends number > ( key : string , hasArgs : N ) : TranslationWithArgs < N > ;
98- static Chat < N extends number > ( key : string , ...args : Tuple < string , N > ) : TranslationWithArgs < N > ;
99- static Chat < N extends number > ( key : string , hasArgs ?: string | N , ...rest : string [ ] ) : TranslationBase | TranslationWithArgs < N > {
101+ static General ( key : string ) : Translation ;
102+ static General < N extends number > ( key : string , hasArgs : N ) : TranslationWithArgs < N > ;
103+ static General < N extends number > ( key : string , ...args : Tuple < string , N > ) : TranslationWithArgs < N > ;
104+ static General < N extends number > ( key : string , hasArgs ?: string | N , ...rest : string [ ] ) : TranslationBase | TranslationWithArgs < N > {
100105 const args = typeof hasArgs === 'string' ? [ hasArgs , ...rest ] : rest ;
101- return new Translation ( `chat .${ key } ` , { args } ) ;
106+ return new Translation ( `general .${ key } ` , { args } ) ;
102107 }
103108
104109 static Menu ( key : string ) : Translation ;
0 commit comments