File tree Expand file tree Collapse file tree 11 files changed +62
-10
lines changed
Expand file tree Collapse file tree 11 files changed +62
-10
lines changed Original file line number Diff line number Diff line change @@ -187,4 +187,9 @@ export class AWSProvider extends TranslationProvider {
187187 getMaxTextLength ( ) : number {
188188 return 10000 ;
189189 }
190+
191+ // No known constraints on text type
192+ supportsText ( text : string ) : boolean {
193+ return true ;
194+ }
190195}
Original file line number Diff line number Diff line change @@ -92,4 +92,9 @@ export class AzureProvider extends TranslationProvider {
9292 getMaxTextLength ( ) : number {
9393 return 50000 ;
9494 }
95+
96+ // No known constraints on text type
97+ supportsText ( text : string ) : boolean {
98+ return true ;
99+ }
95100}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export class BingTranslateProvider extends TranslationProvider {
3030 return this . supportedLanguages . has ( languageCode . toLowerCase ( ) ) ;
3131 }
3232
33+
3334 isAvailable ( ) : boolean {
3435 // Always available since we don't need API keys
3536 return true ;
@@ -43,4 +44,8 @@ export class BingTranslateProvider extends TranslationProvider {
4344 getMaxTextLength ( ) : number {
4445 return 1000 ;
4546 }
47+ // Bing Translate API doesn't support outputting newlines for some reason
48+ supportsText ( text : string ) : boolean {
49+ return text . match ( / \n / g) === null ;
50+ }
4651}
Original file line number Diff line number Diff line change @@ -85,4 +85,9 @@ export class DeepLProvider extends TranslationProvider {
8585 getMaxTextLength ( ) : number {
8686 return 500000 ;
8787 }
88+
89+ // No known constraints on text type
90+ supportsText ( text : string ) : boolean {
91+ return true ;
92+ }
8893}
Original file line number Diff line number Diff line change @@ -50,4 +50,9 @@ export class DeepLXCloudflareProvider extends TranslationProvider {
5050 getMaxTextLength ( ) : number {
5151 return 5000 ;
5252 }
53+
54+ // No known constraints on text type
55+ supportsText ( text : string ) : boolean {
56+ return true ;
57+ }
5358}
Original file line number Diff line number Diff line change @@ -35,4 +35,9 @@ export class DeepLXProvider extends TranslationProvider {
3535 getMaxTextLength ( ) : number {
3636 return 5000 ;
3737 }
38+
39+ // No known constraints on text type
40+ supportsText ( text : string ) : boolean {
41+ return true ;
42+ }
3843}
Original file line number Diff line number Diff line change @@ -48,4 +48,9 @@ export class DeepLXVercelProvider extends TranslationProvider {
4848 getMaxTextLength ( ) : number {
4949 return 5000 ;
5050 }
51+
52+ // No known constraints on text type
53+ supportsText ( text : string ) : boolean {
54+ return true ;
55+ }
5156}
Original file line number Diff line number Diff line change @@ -52,4 +52,9 @@ export class GoogleTranslateProvider extends TranslationProvider {
5252 getMaxTextLength ( ) : number {
5353 return 5000 ;
5454 }
55+
56+ // No known constraints on text type
57+ supportsText ( text : string ) : boolean {
58+ return true ;
59+ }
5560}
Original file line number Diff line number Diff line change @@ -91,6 +91,11 @@ export class LibreTranslateProvider extends TranslationProvider {
9191 return 2000 ;
9292 }
9393
94+ // No known constraints on text type
95+ supportsText ( text : string ) : boolean {
96+ return true ;
97+ }
98+
9499 private async fetchLanguages ( ) : Promise < void > {
95100 if ( this . languagesFetched ) {
96101 return ;
Original file line number Diff line number Diff line change @@ -27,4 +27,7 @@ export abstract class TranslationProvider {
2727
2828 // Get maximum text length this provider can handle (in characters)
2929 abstract getMaxTextLength ( ) : number ;
30+
31+ // Check if provider supports a specific text
32+ abstract supportsText ( text : string ) : boolean ;
3033}
You can’t perform that action at this time.
0 commit comments