aboutsummaryrefslogtreecommitdiff
path: root/types/ext
diff options
context:
space:
mode:
authorCashew <52880648+cashewnuttynuts@users.noreply.github.com>2024-06-24 18:38:39 +0700
committerGitHub <noreply@github.com>2024-06-24 11:38:39 +0000
commitb584c5440721fa7399564ced57f134fd5333d20c (patch)
tree4ea760c9232b4e8d2ab9c0b60bf07f7ed3bad1ef /types/ext
parent8f32410f34b2c839105eb508da9b9e63f6a89194 (diff)
add cn reading processors (#1120)
* add cn reading processors * remove meow * fix lint * add cn reading processors * remove meow * fix lint * wip * update names * update test * remove vestigial code
Diffstat (limited to 'types/ext')
-rw-r--r--types/ext/language-descriptors.d.ts3
-rw-r--r--types/ext/language.d.ts7
-rw-r--r--types/ext/translation-internal.d.ts5
3 files changed, 14 insertions, 1 deletions
diff --git a/types/ext/language-descriptors.d.ts b/types/ext/language-descriptors.d.ts
index 778445de..42312937 100644
--- a/types/ext/language-descriptors.d.ts
+++ b/types/ext/language-descriptors.d.ts
@@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import type {TextProcessor, BidirectionalConversionPreprocessor} from './language';
+import type {TextProcessor, ReadingNormalizer, BidirectionalConversionPreprocessor} from './language';
import type {LanguageTransformDescriptor} from './language-transformer';
import type {SafeAny} from './core';
@@ -36,6 +36,7 @@ type LanguageDescriptor<
* If no value is provided, `true` is assumed for all inputs.
*/
isTextLookupWorthy?: IsTextLookupWorthyFunction;
+ readingNormalizer?: ReadingNormalizer;
textPreprocessors?: TTextPreprocessorDescriptor;
textPostprocessors?: TTextPostprocessorDescriptor;
languageTransforms?: LanguageTransformDescriptor;
diff --git a/types/ext/language.d.ts b/types/ext/language.d.ts
index c708f6e7..ea8c0e47 100644
--- a/types/ext/language.d.ts
+++ b/types/ext/language.d.ts
@@ -33,6 +33,8 @@ export type TextProcessor<T = unknown> = {
process: TextProcessorFunction<T>;
};
+export type ReadingNormalizer = (str: string) => string;
+
export type BidirectionalPreprocessorOptions = 'off' | 'direct' | 'inverse';
export type BidirectionalConversionPreprocessor = TextProcessor<BidirectionalPreprocessorOptions>;
@@ -43,6 +45,11 @@ export type LanguageAndProcessors = {
textPostprocessors?: TextProcessorWithId<unknown>[];
};
+export type LanguageAndReadingNormalizer = {
+ iso: string;
+ readingNormalizer: ReadingNormalizer;
+};
+
export type LanguageAndTransforms = {
iso: string;
languageTransforms: LanguageTransformDescriptor;
diff --git a/types/ext/translation-internal.d.ts b/types/ext/translation-internal.d.ts
index 0efbe54f..05821a64 100644
--- a/types/ext/translation-internal.d.ts
+++ b/types/ext/translation-internal.d.ts
@@ -71,4 +71,9 @@ export type TextProcessorMap = Map<
}
>;
+export type ReadingNormalizerMap = Map<
+ string,
+ Language.ReadingNormalizer
+>;
+
export type TextCache = Map<string, Map<string, Map<unknown, string>>>;