diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-25 11:20:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 16:20:44 +0000 |
commit | 2e9ea19207a7410f929bb908759d48cb2340f29c (patch) | |
tree | a6bde1297d693bb8d50e4c93a963aa3179e5a2ce /types | |
parent | 73169f06dff767020718a5715eba97d3575ba7e1 (diff) |
"isJapanese" check move (#730)
* Move isStringPartiallyJapanese out of ClipboardMonitor
* Create isStringPartiallyJapanese function
* Add textMayBeTranslatable
* Rename API function
* Rename internal function
* Add helper
* Update translatable check
* Pass language to TextScanner
* Pass language explicitly
* Use textMayBeTranslatable
* No redundant translatable check
* Update eslint
* Remove double newline
* Collapse
* Rename
Diffstat (limited to 'types')
-rw-r--r-- | types/ext/api.d.ts | 3 | ||||
-rw-r--r-- | types/ext/application.d.ts | 2 | ||||
-rw-r--r-- | types/ext/display.d.ts | 1 | ||||
-rw-r--r-- | types/ext/language-descriptors.d.ts | 9 |
4 files changed, 13 insertions, 2 deletions
diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 16321722..9a922fb0 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -344,9 +344,10 @@ type ApiSurface = { params: void; return: true; }; - textHasJapaneseCharacters: { + isTextLookupWorthy: { params: { text: string; + language: string; }; return: boolean; }; diff --git a/types/ext/application.d.ts b/types/ext/application.d.ts index 96f76714..8d80894d 100644 --- a/types/ext/application.d.ts +++ b/types/ext/application.d.ts @@ -41,7 +41,7 @@ export type ApiSurface = { searchDisplayControllerUpdateSearchQuery: { params: { text: string; - animate?: boolean; + animate: boolean; }; return: void; }; diff --git a/types/ext/display.d.ts b/types/ext/display.d.ts index 61e1aac5..7f4d8966 100644 --- a/types/ext/display.d.ts +++ b/types/ext/display.d.ts @@ -129,6 +129,7 @@ export type QueryParserOptions = { readingMode: Settings.ParsingReadingMode; useInternalParser: boolean; useMecabParser: boolean; + language: string; scanning: TextScannerTypes.Options; }; diff --git a/types/ext/language-descriptors.d.ts b/types/ext/language-descriptors.d.ts index 319a3ca5..ca457721 100644 --- a/types/ext/language-descriptors.d.ts +++ b/types/ext/language-descriptors.d.ts @@ -18,10 +18,19 @@ import type {TextPreprocessor, BidirectionalConversionPreprocessor} from './language'; import type {SafeAny} from './core'; +export type IsTextLookupWorthyFunction = (text: string) => boolean; + type LanguageDescriptor<TIso extends string, TTextPreprocessorDescriptor extends TextPreprocessorDescriptor> = { iso: TIso; name: string; exampleText: string; + /** + * An optional function which returns whether or not a given string may be translatable. + * This is used as a filter for several situations, such as whether the clipboard monitor + * window should activate when text is copied to the clipboard. + * If no value is provided, `true` is assumed for all inputs. + */ + isTextLookupWorthy?: IsTextLookupWorthyFunction; textPreprocessors: TTextPreprocessorDescriptor; }; |