diff --git a/ts/audio/abstract_audio_renderer.ts b/ts/audio/abstract_audio_renderer.ts index d03d9d5e3..14235f7a5 100644 --- a/ts/audio/abstract_audio_renderer.ts +++ b/ts/audio/abstract_audio_renderer.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { KeyCode } from '../common/event_util.js'; import { AudioRenderer } from './audio_renderer.js'; import { AuditoryDescription } from './auditory_description.js'; diff --git a/ts/audio/audio_util.ts b/ts/audio/audio_util.ts index 05a44abb1..a0d260214 100644 --- a/ts/audio/audio_util.ts +++ b/ts/audio/audio_util.ts @@ -20,7 +20,7 @@ import { setdifference } from '../common/base_util.js'; import * as EngineConst from '../common/engine_const.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { AuditoryDescription } from './auditory_description.js'; import { Span } from './span.js'; diff --git a/ts/audio/aural_rendering.ts b/ts/audio/aural_rendering.ts index 14f2007cc..03455d934 100644 --- a/ts/audio/aural_rendering.ts +++ b/ts/audio/aural_rendering.ts @@ -19,7 +19,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as EngineConst from '../common/engine_const.js'; import { AcssRenderer } from './acss_renderer.js'; import { AudioRenderer } from './audio_renderer.js'; diff --git a/ts/audio/layout_renderer.ts b/ts/audio/layout_renderer.ts index f07a08223..038735b38 100644 --- a/ts/audio/layout_renderer.ts +++ b/ts/audio/layout_renderer.ts @@ -21,7 +21,7 @@ import { Debugger } from '../common/debugger.js'; import * as DomUtil from '../common/dom_util.js'; import * as EngineConst from '../common/engine_const.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as AudioUtil from './audio_util.js'; import { AuditoryDescription } from './auditory_description.js'; import { XmlRenderer } from './xml_renderer.js'; diff --git a/ts/audio/ssml_renderer.ts b/ts/audio/ssml_renderer.ts index 252f9ed21..8e27ab50a 100644 --- a/ts/audio/ssml_renderer.ts +++ b/ts/audio/ssml_renderer.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as EngineConst from '../common/engine_const.js'; import { Pause } from './audio_util.js'; import { AuditoryDescription } from './auditory_description.js'; diff --git a/ts/audio/string_renderer.ts b/ts/audio/string_renderer.ts index 66aa6e44c..2486854b2 100644 --- a/ts/audio/string_renderer.ts +++ b/ts/audio/string_renderer.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { AbstractAudioRenderer } from './abstract_audio_renderer.js'; import { personalityMarkup } from './audio_util.js'; import { AuditoryDescription } from './auditory_description.js'; diff --git a/ts/common/browser_util.ts b/ts/common/browser_util.ts index 9778415d3..86093a8b0 100644 --- a/ts/common/browser_util.ts +++ b/ts/common/browser_util.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; import { xpath } from './xpath_util.js'; /** diff --git a/ts/common/cli.ts b/ts/common/cli.ts index 9c2f3496a..71518e9da 100644 --- a/ts/common/cli.ts +++ b/ts/common/cli.ts @@ -27,7 +27,7 @@ import { EnginePromise, SREError } from './engine.js'; import * as EngineConst from './engine_const.js'; import * as ProcessorFactory from './processor_factory.js'; import * as System from './system.js'; -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; import { Variables } from './variables.js'; export class Cli { diff --git a/ts/common/debugger.ts b/ts/common/debugger.ts index ee0bbf5ad..1f7809e94 100644 --- a/ts/common/debugger.ts +++ b/ts/common/debugger.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; export class Debugger { private static instance: Debugger; diff --git a/ts/common/dom_util.ts b/ts/common/dom_util.ts index d8f1f0a73..b673312dd 100644 --- a/ts/common/dom_util.ts +++ b/ts/common/dom_util.ts @@ -22,9 +22,9 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine, { SREError } from './engine.js'; +import { Engine, SREError } from './engine.js'; import * as EngineConst from '../common/engine_const.js'; -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; import * as XpathUtil from './xpath_util.js'; /** diff --git a/ts/common/engine.ts b/ts/common/engine.ts index 5c38cbc09..92a073b7c 100644 --- a/ts/common/engine.ts +++ b/ts/common/engine.ts @@ -51,7 +51,7 @@ export class SREError extends Error { * Initializes the basic Speech engine and contains some global context. * */ -export default class Engine { +export class Engine { /** * Binary feature vector. */ diff --git a/ts/common/engine_setup.ts b/ts/common/engine_setup.ts index 71cf14ed3..964936a6c 100644 --- a/ts/common/engine_setup.ts +++ b/ts/common/engine_setup.ts @@ -22,9 +22,9 @@ import * as L10n from '../l10n/l10n.js'; import * as MathMap from '../speech_rules/math_map.js'; import * as BrowserUtil from './browser_util.js'; import { Debugger } from './debugger.js'; -import Engine, { EnginePromise } from './engine.js'; +import { Engine, EnginePromise } from './engine.js'; import * as FileUtil from './file_util.js'; -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; // Engine setup method. /** diff --git a/ts/common/file_util.ts b/ts/common/file_util.ts index 245c506d4..8b393abdb 100644 --- a/ts/common/file_util.ts +++ b/ts/common/file_util.ts @@ -19,7 +19,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; /** * Corrects pathnames to have trailing slashes. diff --git a/ts/common/processor_factory.ts b/ts/common/processor_factory.ts index ec1dcc1de..a70390951 100644 --- a/ts/common/processor_factory.ts +++ b/ts/common/processor_factory.ts @@ -28,7 +28,7 @@ import * as SpeechGeneratorUtil from '../speech_generator/speech_generator_util. import * as WalkerFactory from '../walker/walker_factory.js'; import * as WalkerUtil from '../walker/walker_util.js'; import * as DomUtil from './dom_util.js'; -import Engine, { SREError } from './engine.js'; +import { Engine, SREError } from './engine.js'; import * as EngineConst from '../common/engine_const.js'; import { KeyCode } from './event_util.js'; import { Processor, KeyProcessor } from './processor.js'; diff --git a/ts/common/system.ts b/ts/common/system.ts index 784e18f22..fb15f7398 100644 --- a/ts/common/system.ts +++ b/ts/common/system.ts @@ -20,13 +20,13 @@ import { AuditoryDescription } from '../audio/auditory_description.js'; -import Engine, { EnginePromise, SREError } from './engine.js'; +import { Engine, EnginePromise, SREError } from './engine.js'; import { setup } from './engine_setup.js'; import * as EngineConst from './engine_const.js'; import { KeyCode } from './event_util.js'; import * as FileUtil from './file_util.js'; import * as ProcessorFactory from './processor_factory.js'; -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; import { Variables } from './variables.js'; import { standardLoader } from '../speech_rules/math_map.js'; diff --git a/ts/common/system_external.ts b/ts/common/system_external.ts index ead342bf6..0712d61ed 100644 --- a/ts/common/system_external.ts +++ b/ts/common/system_external.ts @@ -27,7 +27,7 @@ declare let global: any; declare let require: (name: string) => any; declare let process: any; -export default class SystemExternal { +export class SystemExternal { /** * The local require function for NodeJS. * diff --git a/ts/common/xpath_util.ts b/ts/common/xpath_util.ts index 56f1e79ff..48e7f1358 100644 --- a/ts/common/xpath_util.ts +++ b/ts/common/xpath_util.ts @@ -22,9 +22,9 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from './engine.js'; +import { Engine } from './engine.js'; import * as EngineConst from '../common/engine_const.js'; -import SystemExternal from './system_external.js'; +import { SystemExternal } from './system_external.js'; /** * Returns whether or not xpath is supported. diff --git a/ts/enrich_mathml/enrich_mathml.ts b/ts/enrich_mathml/enrich_mathml.ts index e89b4cd26..7dbad57da 100644 --- a/ts/enrich_mathml/enrich_mathml.ts +++ b/ts/enrich_mathml/enrich_mathml.ts @@ -23,7 +23,7 @@ import { Debugger } from '../common/debugger.js'; import * as DomUtil from '../common/dom_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { NamedSymbol } from '../semantic_tree/semantic_attr.js'; import { SemanticRole, diff --git a/ts/l10n/l10n.ts b/ts/l10n/l10n.ts index 9a0c80be4..0fa3420da 100644 --- a/ts/l10n/l10n.ts +++ b/ts/l10n/l10n.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { Variables } from '../common/variables.js'; import { Grammar } from '../rule_engine/grammar.js'; diff --git a/ts/l10n/locales/locale_af.ts b/ts/l10n/locales/locale_af.ts index 2b12e50a0..16a07e77a 100644 --- a/ts/l10n/locales/locale_af.ts +++ b/ts/l10n/locales/locale_af.ts @@ -21,7 +21,7 @@ import { Grammar } from '../../rule_engine/grammar.js'; import { nestingToString } from '../locale_util.js'; import { createLocale, Locale } from '../locale.js'; -import NUMBERS from '../numbers/numbers_af.js'; +import { NUMBERS } from '../numbers/numbers_af.js'; import * as tr from '../transformers.js'; const germanPostfixCombiner = function ( diff --git a/ts/l10n/locales/locale_ca.ts b/ts/l10n/locales/locale_ca.ts index 0e9d1a9dc..22c3e3188 100644 --- a/ts/l10n/locales/locale_ca.ts +++ b/ts/l10n/locales/locale_ca.ts @@ -24,7 +24,7 @@ import { createLocale, Locale } from '../locale.js'; import { combinePostfixIndex } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_ca.js'; +import { NUMBERS } from '../numbers/numbers_ca.js'; import { Combiners } from '../transformers.js'; const sansserifCombiner = function (letter: string, font: string, cap: string) { diff --git a/ts/l10n/locales/locale_da.ts b/ts/l10n/locales/locale_da.ts index f900fc620..7668d0bec 100644 --- a/ts/l10n/locales/locale_da.ts +++ b/ts/l10n/locales/locale_da.ts @@ -20,7 +20,7 @@ import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_da.js'; +import { NUMBERS } from '../numbers/numbers_da.js'; import * as tr from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/locales/locale_de.ts b/ts/l10n/locales/locale_de.ts index 3c9a1e4d2..166418a6e 100644 --- a/ts/l10n/locales/locale_de.ts +++ b/ts/l10n/locales/locale_de.ts @@ -25,7 +25,7 @@ import { Grammar } from '../../rule_engine/grammar.js'; import { localFont } from '../locale_util.js'; import { createLocale, Locale } from '../locale.js'; -import NUMBERS from '../numbers/numbers_de.js'; +import { NUMBERS } from '../numbers/numbers_de.js'; const germanPrefixCombiner = function ( letter: string, diff --git a/ts/l10n/locales/locale_en.ts b/ts/l10n/locales/locale_en.ts index 209b0e0ab..2679ae4fc 100644 --- a/ts/l10n/locales/locale_en.ts +++ b/ts/l10n/locales/locale_en.ts @@ -21,7 +21,7 @@ import { Grammar } from '../../rule_engine/grammar.js'; import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_en.js'; +import { NUMBERS } from '../numbers/numbers_en.js'; import * as tr from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/locales/locale_es.ts b/ts/l10n/locales/locale_es.ts index 1f567a7ae..03f3aa111 100644 --- a/ts/l10n/locales/locale_es.ts +++ b/ts/l10n/locales/locale_es.ts @@ -24,7 +24,7 @@ import { createLocale, Locale } from '../locale.js'; import { combinePostfixIndex } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_es.js'; +import { NUMBERS } from '../numbers/numbers_es.js'; import { Combiners } from '../transformers.js'; const sansserifCombiner = function (letter: string, font: string, cap: string) { diff --git a/ts/l10n/locales/locale_fr.ts b/ts/l10n/locales/locale_fr.ts index 426e755ed..3f16f08f3 100644 --- a/ts/l10n/locales/locale_fr.ts +++ b/ts/l10n/locales/locale_fr.ts @@ -25,7 +25,7 @@ import { Grammar } from '../../rule_engine/grammar.js'; import { createLocale, Locale } from '../locale.js'; import { combinePostfixIndex, nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_fr.js'; +import { NUMBERS } from '../numbers/numbers_fr.js'; import { Combiners } from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/locales/locale_hi.ts b/ts/l10n/locales/locale_hi.ts index 519f68e06..beaee2f0d 100644 --- a/ts/l10n/locales/locale_hi.ts +++ b/ts/l10n/locales/locale_hi.ts @@ -23,7 +23,7 @@ // import { createLocale, Locale } from '../locale.js'; -import NUMBERS from '../numbers/numbers_hi.js'; +import { NUMBERS } from '../numbers/numbers_hi.js'; import { Combiners } from '../transformers.js'; import { nestingToString } from '../locale_util.js'; diff --git a/ts/l10n/locales/locale_it.ts b/ts/l10n/locales/locale_it.ts index 5546a27ff..38f1327e6 100644 --- a/ts/l10n/locales/locale_it.ts +++ b/ts/l10n/locales/locale_it.ts @@ -24,7 +24,7 @@ import { combinePostfixIndex, nestingToString } from '../locale_util.js'; import { createLocale, Locale } from '../locale.js'; -import NUMBERS from '../numbers/numbers_it.js'; +import { NUMBERS } from '../numbers/numbers_it.js'; import { Combiners } from '../transformers.js'; const italianPostfixCombiner = function ( diff --git a/ts/l10n/locales/locale_ko.ts b/ts/l10n/locales/locale_ko.ts index 6b2ba84f4..c48b4b544 100644 --- a/ts/l10n/locales/locale_ko.ts +++ b/ts/l10n/locales/locale_ko.ts @@ -22,7 +22,7 @@ import { Grammar } from '../../rule_engine/grammar.js'; import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_ko.js'; +import { NUMBERS } from '../numbers/numbers_ko.js'; import * as tr from '../transformers.js'; diff --git a/ts/l10n/locales/locale_nb.ts b/ts/l10n/locales/locale_nb.ts index 0cedf0730..0b846160e 100644 --- a/ts/l10n/locales/locale_nb.ts +++ b/ts/l10n/locales/locale_nb.ts @@ -24,7 +24,7 @@ import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_nn.js'; +import { NUMBERS } from '../numbers/numbers_nn.js'; import * as tr from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/locales/locale_nemeth.ts b/ts/l10n/locales/locale_nemeth.ts index 3e148e215..f8e068851 100644 --- a/ts/l10n/locales/locale_nemeth.ts +++ b/ts/l10n/locales/locale_nemeth.ts @@ -24,7 +24,7 @@ // import { createLocale, Locale } from '../locale.js'; -import NUMBERS from '../numbers/numbers_nemeth.js'; +import { NUMBERS } from '../numbers/numbers_nemeth.js'; import { identityTransformer } from '../transformers.js'; /** diff --git a/ts/l10n/locales/locale_nn.ts b/ts/l10n/locales/locale_nn.ts index e15a67ed1..27c5b7cac 100644 --- a/ts/l10n/locales/locale_nn.ts +++ b/ts/l10n/locales/locale_nn.ts @@ -24,7 +24,7 @@ import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_nn.js'; +import { NUMBERS } from '../numbers/numbers_nn.js'; import * as tr from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/locales/locale_sv.ts b/ts/l10n/locales/locale_sv.ts index 268922026..6a5128a42 100644 --- a/ts/l10n/locales/locale_sv.ts +++ b/ts/l10n/locales/locale_sv.ts @@ -20,7 +20,7 @@ import { createLocale, Locale } from '../locale.js'; import { nestingToString } from '../locale_util.js'; -import NUMBERS from '../numbers/numbers_sv.js'; +import { NUMBERS } from '../numbers/numbers_sv.js'; import * as tr from '../transformers.js'; let locale: Locale = null; diff --git a/ts/l10n/messages.ts b/ts/l10n/messages.ts index 0d1db85a2..2f4107441 100644 --- a/ts/l10n/messages.ts +++ b/ts/l10n/messages.ts @@ -85,33 +85,36 @@ export interface Numbers { special?: { [key: string]: string | string[] }; // Constructor methods - wordOrdinal: tr.Transformer; - numericOrdinal: tr.Transformer; - numberToWords: tr.Transformer; - numberToOrdinal: tr.GrammarCase; + wordOrdinal?: tr.Transformer; + numericOrdinal?: tr.Transformer; + numberToWords?: tr.Transformer; + numberToOrdinal?: tr.GrammarCase; - vulgarSep: string; - numSep: string; + vulgarSep?: string; + numSep?: string; } /** * @returns A numbers structure. */ -export function NUMBERS(): Numbers { - return { - zero: 'zero', - ones: [], - tens: [], - large: [], - special: {}, +export function NUMBERS(numbers: Numbers = {}): Numbers { + return Object.assign( + { + zero: 'zero', + ones: [], + tens: [], + large: [], + special: {}, - wordOrdinal: tr.identityTransformer, - numericOrdinal: tr.identityTransformer, - numberToWords: tr.identityTransformer, - numberToOrdinal: tr.pluralCase, - vulgarSep: ' ', - numSep: ' ' - }; + wordOrdinal: tr.identityTransformer, + numericOrdinal: tr.identityTransformer, + numberToWords: tr.identityTransformer, + numberToOrdinal: tr.pluralCase, + vulgarSep: ' ', + numSep: ' ' + }, + numbers + ); } /** diff --git a/ts/l10n/numbers/numbers_af.ts b/ts/l10n/numbers/numbers_af.ts index 2b686d7cd..fc0caa7ed 100644 --- a/ts/l10n/numbers/numbers_af.ts +++ b/ts/l10n/numbers/numbers_af.ts @@ -132,10 +132,11 @@ function numericOrdinal(num: number): string { return num.toString() + '.'; } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_ca.ts b/ts/l10n/numbers/numbers_ca.ts index fd784a57a..00195e6a4 100644 --- a/ts/l10n/numbers/numbers_ca.ts +++ b/ts/l10n/numbers/numbers_ca.ts @@ -144,9 +144,10 @@ function numericOrdinal(num: number): string { return num.toString() + (gender === 'f' ? 'a' : 'n'); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_da.ts b/ts/l10n/numbers/numbers_da.ts index 04c6fb460..278ffd1e0 100644 --- a/ts/l10n/numbers/numbers_da.ts +++ b/ts/l10n/numbers/numbers_da.ts @@ -146,10 +146,11 @@ function numericOrdinal(num: number): string { return num.toString() + '.'; } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_de.ts b/ts/l10n/numbers/numbers_de.ts index acfe5a489..a0befc5bb 100644 --- a/ts/l10n/numbers/numbers_de.ts +++ b/ts/l10n/numbers/numbers_de.ts @@ -146,10 +146,11 @@ function numericOrdinal(num: number): string { return num.toString() + '.'; } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_en.ts b/ts/l10n/numbers/numbers_en.ts index bb1133366..d615eb208 100644 --- a/ts/l10n/numbers/numbers_en.ts +++ b/ts/l10n/numbers/numbers_en.ts @@ -145,11 +145,11 @@ function numericOrdinal(num: number): string { } } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; -// TODO: For simple speech output this should be different. +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_es.ts b/ts/l10n/numbers/numbers_es.ts index df887186f..491891f9b 100644 --- a/ts/l10n/numbers/numbers_es.ts +++ b/ts/l10n/numbers/numbers_es.ts @@ -152,9 +152,10 @@ function numericOrdinal(num: number): string { return num.toString() + (gender === 'f' ? 'a' : 'o'); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_fr.ts b/ts/l10n/numbers/numbers_fr.ts index 30aa33c0e..5b8ecb76e 100644 --- a/ts/l10n/numbers/numbers_fr.ts +++ b/ts/l10n/numbers/numbers_fr.ts @@ -22,7 +22,7 @@ // This work was sponsored by TextHelp // -import Engine from '../../common/engine.js'; +import { Engine } from '../../common/engine.js'; import { Grammar } from '../../rule_engine/grammar.js'; import { Numbers, NUMBERS as NUMB } from '../messages.js'; @@ -167,10 +167,11 @@ function numericOrdinal(num: number): string { : num.toString() + 'e'; } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_hi.ts b/ts/l10n/numbers/numbers_hi.ts index de9b19257..57185f2d9 100644 --- a/ts/l10n/numbers/numbers_hi.ts +++ b/ts/l10n/numbers/numbers_hi.ts @@ -143,10 +143,11 @@ function numericOrdinal(num: number): string { return ordinal + (gender === 'f' ? 'वीं' : 'वाँ'); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_it.ts b/ts/l10n/numbers/numbers_it.ts index 4c9a890e8..46f324547 100644 --- a/ts/l10n/numbers/numbers_it.ts +++ b/ts/l10n/numbers/numbers_it.ts @@ -136,10 +136,11 @@ function numericOrdinal(num: number): string { return num.toString() + (gender === 'm' ? 'o' : 'a'); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_ko.ts b/ts/l10n/numbers/numbers_ko.ts index 413b786ea..fb7fe4f8f 100644 --- a/ts/l10n/numbers/numbers_ko.ts +++ b/ts/l10n/numbers/numbers_ko.ts @@ -104,10 +104,11 @@ function numericOrdinal(num: number): string { return numberToOrdinal(num, false); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/l10n/numbers/numbers_nemeth.ts b/ts/l10n/numbers/numbers_nemeth.ts index 797da7719..d67804364 100644 --- a/ts/l10n/numbers/numbers_nemeth.ts +++ b/ts/l10n/numbers/numbers_nemeth.ts @@ -39,8 +39,9 @@ function numberToWords(num: number): string { .join(''); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToWords; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToWords, + } +); diff --git a/ts/l10n/numbers/numbers_nn.ts b/ts/l10n/numbers/numbers_nn.ts index efa28becc..891c9c4ee 100644 --- a/ts/l10n/numbers/numbers_nn.ts +++ b/ts/l10n/numbers/numbers_nn.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../../common/engine.js'; +import { Engine } from '../../common/engine.js'; import { Numbers, NUMBERS as NUMB } from '../messages.js'; /** @@ -154,13 +154,14 @@ function numericOrdinal(num: number): string { return num.toString() + '.'; } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); // TODO: For simple speech output this should be different. // Alternative Germanic style numbers: diff --git a/ts/l10n/numbers/numbers_sv.ts b/ts/l10n/numbers/numbers_sv.ts index 7616f9676..c19282b14 100644 --- a/ts/l10n/numbers/numbers_sv.ts +++ b/ts/l10n/numbers/numbers_sv.ts @@ -161,11 +161,11 @@ function numericOrdinal(num: number): string { return str + (str.match(/1$|2$/) ? ':a' : ':e'); } -const NUMBERS: Numbers = NUMB(); -NUMBERS.wordOrdinal = wordOrdinal; -NUMBERS.numericOrdinal = numericOrdinal; -NUMBERS.numberToWords = numberToWords; -NUMBERS.numberToOrdinal = numberToOrdinal; - -export default NUMBERS; -// TODO: For simple speech output this should be different. +export const NUMBERS: Numbers = NUMB( + { + 'wordOrdinal': wordOrdinal, + 'numericOrdinal': numericOrdinal, + 'numberToWords': numberToWords, + 'numberToOrdinal': numberToOrdinal, + } +); diff --git a/ts/rule_engine/grammar.ts b/ts/rule_engine/grammar.ts index 03da9e347..c30c6672a 100644 --- a/ts/rule_engine/grammar.ts +++ b/ts/rule_engine/grammar.ts @@ -23,7 +23,7 @@ */ import * as DomUtil from '../common/dom_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as LocaleUtil from '../l10n/locale_util.js'; import { LOCALE } from '../l10n/locale.js'; import { DynamicCstr } from './dynamic_cstr.js'; diff --git a/ts/rule_engine/math_compound_store.ts b/ts/rule_engine/math_compound_store.ts index 5b87a57b1..a9ec489b1 100644 --- a/ts/rule_engine/math_compound_store.ts +++ b/ts/rule_engine/math_compound_store.ts @@ -21,7 +21,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { locales } from '../l10n/l10n.js'; import { addFunctionSemantic } from '../semantic_tree/semantic_attr.js'; import { diff --git a/ts/rule_engine/math_simple_store.ts b/ts/rule_engine/math_simple_store.ts index b8bbb9b64..f2a799591 100644 --- a/ts/rule_engine/math_simple_store.ts +++ b/ts/rule_engine/math_simple_store.ts @@ -24,7 +24,7 @@ * @author sorge@google.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { Axis, DynamicCstr } from './dynamic_cstr.js'; export interface MappingsJson { diff --git a/ts/rule_engine/speech_rule_engine.ts b/ts/rule_engine/speech_rule_engine.ts index 0ca279e52..72944a8f2 100644 --- a/ts/rule_engine/speech_rule_engine.ts +++ b/ts/rule_engine/speech_rule_engine.ts @@ -33,7 +33,7 @@ import { AuditoryDescription, AuditoryList } from '../audio/auditory_description import { Span } from '../audio/span.js'; import { Debugger } from '../common/debugger.js'; import * as DomUtil from '../common/dom_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as EngineConst from '../common/engine_const.js'; import { evalXPath, updateEvaluator } from '../common/xpath_util.js'; import { ClearspeakPreferences } from '../speech_rules/clearspeak_preferences.js'; diff --git a/ts/rule_engine/store_util.ts b/ts/rule_engine/store_util.ts index ae55af520..c0b20f5c6 100644 --- a/ts/rule_engine/store_util.ts +++ b/ts/rule_engine/store_util.ts @@ -20,7 +20,7 @@ */ import { AuditoryDescription } from '../audio/auditory_description.js'; import * as XpathUtil from '../common/xpath_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; /** * Count list of nodes and concatenate this with the context string. diff --git a/ts/semantic_tree/semantic_heuristics.ts b/ts/semantic_tree/semantic_heuristics.ts index 617acb596..d7460b7c4 100644 --- a/ts/semantic_tree/semantic_heuristics.ts +++ b/ts/semantic_tree/semantic_heuristics.ts @@ -21,7 +21,7 @@ */ import { Debugger } from '../common/debugger.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { NamedSymbol } from './semantic_attr.js'; import { SemanticHeuristics } from './semantic_heuristic_factory.js'; import { @@ -31,7 +31,7 @@ import { import { SemanticRole, SemanticType } from './semantic_meaning.js'; import { SemanticNode } from './semantic_node.js'; import * as SemanticPred from './semantic_pred.js'; -import SemanticProcessor from './semantic_processor.js'; +import { SemanticProcessor } from './semantic_processor.js'; import * as SemanticUtil from './semantic_util.js'; import { SemanticSkeleton } from './semantic_skeleton.js'; import { MMLTAGS } from '../semantic_tree/semantic_util.js'; diff --git a/ts/semantic_tree/semantic_mathml.ts b/ts/semantic_tree/semantic_mathml.ts index 053718362..458207b31 100644 --- a/ts/semantic_tree/semantic_mathml.ts +++ b/ts/semantic_tree/semantic_mathml.ts @@ -28,7 +28,7 @@ import { SemanticMap } from './semantic_attr.js'; import { SemanticNode } from './semantic_node.js'; import { SemanticAbstractParser } from './semantic_parser.js'; import * as SemanticPred from './semantic_pred.js'; -import SemanticProcessor from './semantic_processor.js'; +import { SemanticProcessor } from './semantic_processor.js'; import * as SemanticUtil from './semantic_util.js'; import { MMLTAGS } from '../semantic_tree/semantic_util.js'; diff --git a/ts/semantic_tree/semantic_processor.ts b/ts/semantic_tree/semantic_processor.ts index 2f489324d..b2d38d428 100644 --- a/ts/semantic_tree/semantic_processor.ts +++ b/ts/semantic_tree/semantic_processor.ts @@ -43,7 +43,7 @@ interface BoundsType { accent?: boolean; } -export default class SemanticProcessor { +export class SemanticProcessor { private static readonly FENCE_TO_PUNCT_: { [key: string]: SemanticRole } = { [SemanticRole.METRIC]: SemanticRole.METRIC, [SemanticRole.NEUTRAL]: SemanticRole.VBAR, diff --git a/ts/semantic_tree/semantic_skeleton.ts b/ts/semantic_tree/semantic_skeleton.ts index 7fd6772cd..7b9639180 100644 --- a/ts/semantic_tree/semantic_skeleton.ts +++ b/ts/semantic_tree/semantic_skeleton.ts @@ -20,7 +20,7 @@ */ import * as BaseUtil from '../common/base_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as XpathUtil from '../common/xpath_util.js'; import { Attribute as EnrichAttribute } from '../enrich_mathml/enrich_attr.js'; diff --git a/ts/speech_rules/alphabet_generator.ts b/ts/speech_rules/alphabet_generator.ts index 12fcc6af5..62dc45929 100644 --- a/ts/speech_rules/alphabet_generator.ts +++ b/ts/speech_rules/alphabet_generator.ts @@ -19,7 +19,7 @@ */ import * as Alphabet from './alphabet.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as L10n from '../l10n/l10n.js'; import { LOCALE } from '../l10n/locale.js'; import { localeFontCombiner } from '../l10n/locale_util.js'; diff --git a/ts/speech_rules/clearspeak_preferences.ts b/ts/speech_rules/clearspeak_preferences.ts index ebbec9d18..56c7b8dcd 100644 --- a/ts/speech_rules/clearspeak_preferences.ts +++ b/ts/speech_rules/clearspeak_preferences.ts @@ -18,7 +18,7 @@ * @author volker.sorge@gmail.com (Volker Sorge) */ -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as EngineConst from '../common/engine_const.js'; import { DynamicCstr } from '../rule_engine/dynamic_cstr.js'; import { diff --git a/ts/speech_rules/clearspeak_util.ts b/ts/speech_rules/clearspeak_util.ts index d3b9ea4ba..bb732f620 100644 --- a/ts/speech_rules/clearspeak_util.ts +++ b/ts/speech_rules/clearspeak_util.ts @@ -20,7 +20,7 @@ import { Span } from '../audio/span.js'; import * as DomUtil from '../common/dom_util.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import * as XpathUtil from '../common/xpath_util.js'; import { LOCALE } from '../l10n/locale.js'; import { vulgarFractionSmall } from '../l10n/transformers.js'; diff --git a/ts/speech_rules/math_map.ts b/ts/speech_rules/math_map.ts index 9f715b668..d02311ffd 100644 --- a/ts/speech_rules/math_map.ts +++ b/ts/speech_rules/math_map.ts @@ -22,10 +22,10 @@ */ import * as BrowserUtil from '../common/browser_util.js'; -import Engine, { EnginePromise } from '../common/engine.js'; +import { Engine, EnginePromise } from '../common/engine.js'; import * as EngineConst from '../common/engine_const.js'; import * as FileUtil from '../common/file_util.js'; -import SystemExternal from '../common/system_external.js'; +import { SystemExternal } from '../common/system_external.js'; import { RulesJson } from '../rule_engine/base_rule_store.js'; import { DynamicCstr } from '../rule_engine/dynamic_cstr.js'; import * as MathCompoundStore from '../rule_engine/math_compound_store.js'; diff --git a/ts/speech_rules/mathspeak_util.ts b/ts/speech_rules/mathspeak_util.ts index 9f17ca67e..ac3531a5e 100644 --- a/ts/speech_rules/mathspeak_util.ts +++ b/ts/speech_rules/mathspeak_util.ts @@ -32,7 +32,7 @@ import { SemanticType } from '../semantic_tree/semantic_meaning.js'; import { SemanticNode } from '../semantic_tree/semantic_node.js'; -import SemanticProcessor from '../semantic_tree/semantic_processor.js'; +import { SemanticProcessor } from '../semantic_tree/semantic_processor.js'; // import * as NumbersUtil from './numbers_util.js'; diff --git a/ts/speech_rules/nemeth_util.ts b/ts/speech_rules/nemeth_util.ts index 291298755..adb25db3e 100644 --- a/ts/speech_rules/nemeth_util.ts +++ b/ts/speech_rules/nemeth_util.ts @@ -23,7 +23,7 @@ import { Span } from '../audio/span.js'; import * as DomUtil from '../common/dom_util.js'; import * as XpathUtil from '../common/xpath_util.js'; import { Grammar, correctFont } from '../rule_engine/grammar.js'; -import Engine from '../common/engine.js'; +import { Engine } from '../common/engine.js'; import { register, activate } from '../semantic_tree/semantic_annotations.js'; import { SemanticVisitor } from '../semantic_tree/semantic_annotator.js'; import { diff --git a/ts/walker/rebuild_stree.ts b/ts/walker/rebuild_stree.ts index a27824fda..1c11ff775 100644 --- a/ts/walker/rebuild_stree.ts +++ b/ts/walker/rebuild_stree.ts @@ -29,7 +29,7 @@ import { } from '../semantic_tree/semantic_meaning.js'; import { SemanticNode } from '../semantic_tree/semantic_node.js'; import { SemanticNodeFactory } from '../semantic_tree/semantic_node_factory.js'; -import SemanticProcessor from '../semantic_tree/semantic_processor.js'; +// import SemanticProcessor from '../semantic_tree/semantic_processor.js'; import { SemanticSkeleton, Sexp } from '../semantic_tree/semantic_skeleton.js'; import { SemanticTree } from '../semantic_tree/semantic_tree.js'; import * as WalkerUtil from './walker_util.js'; @@ -115,7 +115,7 @@ export class RebuildStree { this.streeRoot = this.assembleTree(this.mmlRoot); this.stree = SemanticTree.fromNode(this.streeRoot, this.mathml); this.xml = this.stree.xml(); - SemanticProcessor.getInstance().setNodeFactory(this.factory); + // SemanticProcessor.getInstance().setNodeFactory(this.factory); } /**