| 1 | // |
| 2 | // Copyright 2020-21 Volker Sorge |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | /** |
| 17 | * @file Basic messages for localisation. |
| 18 | * @author [email protected] (Volker Sorge) |
| 19 | */ |
| 20 | |
| 21 | import * as trscip-typescript npm . . l10n/`transformers.ts`/ from './transformers.js'scip-typescript npm . . l10n/`transformers.ts`/; |
| 22 | |
| 23 | /** |
| 24 | * General messages for Mathspek, fonts, etc. |
| 25 | */ |
| 26 | export interface Messagesscip-typescript npm . . l10n/`messages.ts`/Messages# { |
| 27 | // Mathspeak messages |
| 28 | MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS.: { [msg: string]: string }; |
| 29 | // Mathspeak root message |
| 30 | MSrootsscip-typescript npm . . l10n/`messages.ts`/Messages#MSroots.: { [msg: string]: string }; |
| 31 | fontscip-typescript npm . . l10n/`messages.ts`/Messages#font.: { [msg: string]: string | [string, string] }; |
| 32 | embellishscip-typescript npm . . l10n/`messages.ts`/Messages#embellish.: { [msg: string]: string | [string, string] }; |
| 33 | rolescip-typescript npm . . l10n/`messages.ts`/Messages#role.: { [msg: string]: string | [string, string] }; |
| 34 | enclosescip-typescript npm . . l10n/`messages.ts`/Messages#enclose.: { [msg: string]: string | [string, string] }; |
| 35 | navigatescip-typescript npm . . l10n/`messages.ts`/Messages#navigate.: { [msg: string]: string }; |
| 36 | regexpscip-typescript npm . . l10n/`messages.ts`/Messages#regexp.: { [msg: string]: string }; |
| 37 | unitTimesscip-typescript npm . . l10n/`messages.ts`/Messages#unitTimes.: string; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @returns A basic message structure. |
| 42 | */ |
| 43 | export function MESSAGESscip-typescript npm . . l10n/`messages.ts`/MESSAGES().(): Messagesscip-typescript npm . . l10n/`messages.ts`/Messages# { |
| 44 | return { |
| 45 | MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS.: {}, |
| 46 | MSrootsscip-typescript npm . . l10n/`messages.ts`/Messages#MSroots.: {}, |
| 47 | fontscip-typescript npm . . l10n/`messages.ts`/Messages#font.: {}, |
| 48 | embellishscip-typescript npm . . l10n/`messages.ts`/Messages#embellish.: {}, |
| 49 | rolescip-typescript npm . . l10n/`messages.ts`/Messages#role.: {}, |
| 50 | enclosescip-typescript npm . . l10n/`messages.ts`/Messages#enclose.: {}, |
| 51 | navigatescip-typescript npm . . l10n/`messages.ts`/Messages#navigate.: {}, |
| 52 | regexpscip-typescript npm . . l10n/`messages.ts`/Messages#regexp.: {}, |
| 53 | unitTimesscip-typescript npm . . l10n/`messages.ts`/Messages#unitTimes.: '' |
| 54 | }; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Basic types and structurs for localised numbers. |
| 59 | */ |
| 60 | export interface Numbersscip-typescript npm . . l10n/`messages.ts`/Numbers# { |
| 61 | /** |
| 62 | * The word for zero. |
| 63 | */ |
| 64 | zeroscip-typescript npm . . l10n/`messages.ts`/Numbers#zero.?: string; |
| 65 | |
| 66 | /** |
| 67 | * String representation of one to nineteen (or higher). |
| 68 | * The zero position is generally left empty. |
| 69 | */ |
| 70 | onesscip-typescript npm . . l10n/`messages.ts`/Numbers#ones.?: string[]; |
| 71 | |
| 72 | /** |
| 73 | * String representation of twenty to ninety. |
| 74 | */ |
| 75 | tensscip-typescript npm . . l10n/`messages.ts`/Numbers#tens.?: string[]; |
| 76 | |
| 77 | /** |
| 78 | * String representation of thousand to decillion. |
| 79 | */ |
| 80 | largescip-typescript npm . . l10n/`messages.ts`/Numbers#large.?: string[]; |
| 81 | |
| 82 | /** |
| 83 | * Other special representations that are loaded via locale. |
| 84 | */ |
| 85 | specialscip-typescript npm . . l10n/`messages.ts`/Numbers#special.?: { [key: string]: string | string[] }; |
| 86 | |
| 87 | // Constructor methods |
| 88 | wordOrdinalscip-typescript npm . . l10n/`messages.ts`/Numbers#wordOrdinal.?: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer#; |
| 89 | numericOrdinalscip-typescript npm . . l10n/`messages.ts`/Numbers#numericOrdinal.?: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer#; |
| 90 | numberToWordsscip-typescript npm . . l10n/`messages.ts`/Numbers#numberToWords.?: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer#; |
| 91 | numberToOrdinalscip-typescript npm . . l10n/`messages.ts`/Numbers#numberToOrdinal.?: trscip-typescript npm . . l10n/`transformers.ts`/.GrammarCasescip-typescript npm . . l10n/`transformers.ts`/GrammarCase#; |
| 92 | |
| 93 | vulgarSepscip-typescript npm . . l10n/`messages.ts`/Numbers#vulgarSep.?: string; |
| 94 | numSepscip-typescript npm . . l10n/`messages.ts`/Numbers#numSep.?: string; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Assigns numbers messages of a locale to the default numbers structure. |
| 99 | * |
| 100 | * @param numbers The numbers structure to assign. |
| 101 | * @returns A numbers structure. |
| 102 | */ |
| 103 | export function NUMBERSscip-typescript npm . . l10n/`messages.ts`/NUMBERS().(numbersscip-typescript npm . . l10n/`messages.ts`/NUMBERS().(numbers): Numbersscip-typescript npm . . l10n/`messages.ts`/Numbers# = {}): Numbersscip-typescript npm . . l10n/`messages.ts`/Numbers# { |
| 104 | return Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.assignscip-typescript npm typescript 5.9.3 lib/`lib.es2015.core.d.ts`/ObjectConstructor#assign().( |
| 105 | { |
| 106 | zeroscip-typescript npm . . l10n/`messages.ts`/zero0:: 'zero', |
| 107 | onesscip-typescript npm . . l10n/`messages.ts`/ones0:: [], |
| 108 | tensscip-typescript npm . . l10n/`messages.ts`/tens0:: [], |
| 109 | largescip-typescript npm . . l10n/`messages.ts`/large0:: [], |
| 110 | specialscip-typescript npm . . l10n/`messages.ts`/special0:: {}, |
| 111 | |
| 112 | wordOrdinalscip-typescript npm . . l10n/`messages.ts`/wordOrdinal0:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer()., |
| 113 | numericOrdinalscip-typescript npm . . l10n/`messages.ts`/numericOrdinal0:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer()., |
| 114 | numberToWordsscip-typescript npm . . l10n/`messages.ts`/numberToWords0:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer()., |
| 115 | numberToOrdinalscip-typescript npm . . l10n/`messages.ts`/numberToOrdinal0:: trscip-typescript npm . . l10n/`transformers.ts`/.pluralCasescip-typescript npm . . l10n/`transformers.ts`/pluralCase()., |
| 116 | vulgarSepscip-typescript npm . . l10n/`messages.ts`/vulgarSep0:: ' ', |
| 117 | numSepscip-typescript npm . . l10n/`messages.ts`/numSep0:: ' ' |
| 118 | }, |
| 119 | numbersscip-typescript npm . . l10n/`messages.ts`/NUMBERS().(numbers) |
| 120 | ); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Basic types and structurs for localising alphabts. |
| 125 | */ |
| 126 | export interface Alphabetsscip-typescript npm . . l10n/`messages.ts`/Alphabets# { |
| 127 | /** |
| 128 | * Localisable alphabets. |
| 129 | */ |
| 130 | latinSmallscip-typescript npm . . l10n/`messages.ts`/Alphabets#latinSmall.: string[]; |
| 131 | latinCapscip-typescript npm . . l10n/`messages.ts`/Alphabets#latinCap.: string[]; |
| 132 | greekSmallscip-typescript npm . . l10n/`messages.ts`/Alphabets#greekSmall.: string[]; |
| 133 | greekCapscip-typescript npm . . l10n/`messages.ts`/Alphabets#greekCap.: string[]; |
| 134 | |
| 135 | /** |
| 136 | * Prefixes for alphabet rules that can be specialised by rule set. |
| 137 | */ |
| 138 | capPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#capPrefix.: { [key: string]: string }; |
| 139 | smallPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#smallPrefix.: { [key: string]: string }; |
| 140 | digitPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#digitPrefix.: { [key: string]: string }; |
| 141 | languagePrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#languagePrefix.?: { [key: string]: string }; |
| 142 | |
| 143 | /** |
| 144 | * Transformer functions for alphabet rules that can be specialised by rule |
| 145 | * set. |
| 146 | */ |
| 147 | digitTransscip-typescript npm . . l10n/`messages.ts`/Alphabets#digitTrans.: { [key: string]: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer# }; |
| 148 | letterTransscip-typescript npm . . l10n/`messages.ts`/Alphabets#letterTrans.: { [key: string]: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer# }; |
| 149 | |
| 150 | /** |
| 151 | * A default combiner for alphabet. |
| 152 | * |
| 153 | * @param letter The letter. |
| 154 | * @param font The font name. |
| 155 | * @param cap Capitalisation expression. |
| 156 | * @returns The speech string as `letter`. |
| 157 | */ |
| 158 | combinerscip-typescript npm . . l10n/`messages.ts`/Alphabets#combiner.: trscip-typescript npm . . l10n/`transformers.ts`/.Combinerscip-typescript npm . . l10n/`transformers.ts`/Combiner#; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * @returns A localisable alphabet structure |
| 163 | */ |
| 164 | export function ALPHABETSscip-typescript npm . . l10n/`messages.ts`/ALPHABETS().(): Alphabetsscip-typescript npm . . l10n/`messages.ts`/Alphabets# { |
| 165 | return { |
| 166 | latinSmallscip-typescript npm . . l10n/`messages.ts`/Alphabets#latinSmall.: [], |
| 167 | latinCapscip-typescript npm . . l10n/`messages.ts`/Alphabets#latinCap.: [], |
| 168 | greekSmallscip-typescript npm . . l10n/`messages.ts`/Alphabets#greekSmall.: [], |
| 169 | greekCapscip-typescript npm . . l10n/`messages.ts`/Alphabets#greekCap.: [], |
| 170 | capPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#capPrefix.: { defaultscip-typescript npm . . l10n/`messages.ts`/default0:: '' }, |
| 171 | smallPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#smallPrefix.: { defaultscip-typescript npm . . l10n/`messages.ts`/default1:: '' }, |
| 172 | digitPrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#digitPrefix.: { defaultscip-typescript npm . . l10n/`messages.ts`/default2:: '' }, |
| 173 | languagePrefixscip-typescript npm . . l10n/`messages.ts`/Alphabets#languagePrefix.: {}, |
| 174 | digitTransscip-typescript npm . . l10n/`messages.ts`/Alphabets#digitTrans.: { |
| 175 | defaultscip-typescript npm . . l10n/`messages.ts`/default3:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer()., |
| 176 | mathspeakscip-typescript npm . . l10n/`messages.ts`/mathspeak0:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer()., |
| 177 | clearspeakscip-typescript npm . . l10n/`messages.ts`/clearspeak0:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer(). |
| 178 | }, |
| 179 | letterTransscip-typescript npm . . l10n/`messages.ts`/Alphabets#letterTrans.: { defaultscip-typescript npm . . l10n/`messages.ts`/default4:: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer(). }, |
| 180 | combinerscip-typescript npm . . l10n/`messages.ts`/Alphabets#combiner.: (letter: string, _font: string, _cap: string) => { |
| 181 | return letter; |
| 182 | } |
| 183 | }; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Fixed functions needed for generating localised messages. |
| 188 | */ |
| 189 | export interface Functionsscip-typescript npm . . l10n/`messages.ts`/Functions# { |
| 190 | /** |
| 191 | * Method to determine end of nesting depth for nested fraction. |
| 192 | * |
| 193 | * @param node A node. |
| 194 | * @returns True if current element should not be considered for |
| 195 | * nesting depth. |
| 196 | */ |
| 197 | fracNestDepthscip-typescript npm . . l10n/`messages.ts`/Functions#fracNestDepth.: (node: Elementscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Element#) => boolean; |
| 198 | |
| 199 | /** |
| 200 | * Translation for count word nesting description of radicals. |
| 201 | * |
| 202 | * @param count The counting parameter. |
| 203 | * @returns The corresponding string. |
| 204 | */ |
| 205 | radicalNestDepthscip-typescript npm . . l10n/`messages.ts`/Functions#radicalNestDepth.: (count: number) => string; |
| 206 | |
| 207 | /** |
| 208 | * Generates a root ending message by combining the end message (postfix) |
| 209 | * with the index. Example: Start Root Cubic ... End Root Cubic. |
| 210 | * |
| 211 | * @param postfix The postfix. |
| 212 | * @param index The index. |
| 213 | * @returns The combined string, postfix plus index. |
| 214 | */ |
| 215 | combineRootIndexscip-typescript npm . . l10n/`messages.ts`/Functions#combineRootIndex.: (name: string, index: string) => string; |
| 216 | |
| 217 | combineNestedFractionscip-typescript npm . . l10n/`messages.ts`/Functions#combineNestedFraction.: trscip-typescript npm . . l10n/`transformers.ts`/.Combinerscip-typescript npm . . l10n/`transformers.ts`/Combiner#; |
| 218 | combineNestedRadicalscip-typescript npm . . l10n/`messages.ts`/Functions#combineNestedRadical.: trscip-typescript npm . . l10n/`transformers.ts`/.Combinerscip-typescript npm . . l10n/`transformers.ts`/Combiner#; |
| 219 | fontRegexpscip-typescript npm . . l10n/`messages.ts`/Functions#fontRegexp.: (font: string) => RegExpscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/RegExp#; |
| 220 | |
| 221 | /** |
| 222 | * The units combiner. |
| 223 | */ |
| 224 | siscip-typescript npm . . l10n/`messages.ts`/Functions#si.: trscip-typescript npm . . l10n/`transformers.ts`/.SiCombinerscip-typescript npm . . l10n/`transformers.ts`/SiCombiner#; |
| 225 | |
| 226 | /** |
| 227 | * Function to build regular plurals for units. |
| 228 | * |
| 229 | * @param unit A unit expression. |
| 230 | * @returns The unit in plural. |
| 231 | */ |
| 232 | pluralscip-typescript npm . . l10n/`messages.ts`/Functions#plural.: trscip-typescript npm . . l10n/`transformers.ts`/.Transformerscip-typescript npm . . l10n/`transformers.ts`/Transformer#; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * @returns A functions structure. |
| 237 | */ |
| 238 | export function FUNCTIONSscip-typescript npm . . l10n/`messages.ts`/FUNCTIONS().(): Functionsscip-typescript npm . . l10n/`messages.ts`/Functions# { |
| 239 | return { |
| 240 | fracNestDepthscip-typescript npm . . l10n/`messages.ts`/Functions#fracNestDepth.: (n: Elementscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Element#) => trscip-typescript npm . . l10n/`transformers.ts`/.vulgarFractionSmallscip-typescript npm . . l10n/`transformers.ts`/vulgarFractionSmall().(n, 10, 100), |
| 241 | radicalNestDepthscip-typescript npm . . l10n/`messages.ts`/Functions#radicalNestDepth.: (_count: number) => '', |
| 242 | combineRootIndexscip-typescript npm . . l10n/`messages.ts`/Functions#combineRootIndex.: function (postfix: string, _index: string) { |
| 243 | return postfix; |
| 244 | }, |
| 245 | combineNestedFractionscip-typescript npm . . l10n/`messages.ts`/Functions#combineNestedFraction.: trscip-typescript npm . . l10n/`transformers.ts`/.Combinersscip-typescript npm . . l10n/`transformers.ts`/Combiners..identityCombiner, |
| 246 | combineNestedRadicalscip-typescript npm . . l10n/`messages.ts`/Functions#combineNestedRadical.: trscip-typescript npm . . l10n/`transformers.ts`/.Combinersscip-typescript npm . . l10n/`transformers.ts`/Combiners..identityCombiner, |
| 247 | fontRegexpscip-typescript npm . . l10n/`messages.ts`/Functions#fontRegexp.: function (font: string) { |
| 248 | return new RegExpscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/RegExp#('^' + font.splitscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/String#split().(/ |-/).joinscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#join().('( |-)') + '( |-)'); |
| 249 | }, |
| 250 | siscip-typescript npm . . l10n/`messages.ts`/Functions#si.: trscip-typescript npm . . l10n/`transformers.ts`/.siCombinerscip-typescript npm . . l10n/`transformers.ts`/siCombiner()., |
| 251 | pluralscip-typescript npm . . l10n/`messages.ts`/Functions#plural.: trscip-typescript npm . . l10n/`transformers.ts`/.identityTransformerscip-typescript npm . . l10n/`transformers.ts`/identityTransformer(). |
| 252 | }; |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * Fixed functions needed for generating localised messages. |
| 257 | */ |
| 258 | export interface SubIsoscip-typescript npm . . l10n/`messages.ts`/SubIso# { |
| 259 | defaultscip-typescript npm . . l10n/`messages.ts`/SubIso#default.: string; |
| 260 | currentscip-typescript npm . . l10n/`messages.ts`/SubIso#current.: string; |
| 261 | allscip-typescript npm . . l10n/`messages.ts`/SubIso#all.: string[]; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * @returns An empty subiso specification. |
| 266 | */ |
| 267 | export function SUBISOscip-typescript npm . . l10n/`messages.ts`/SUBISO().(): SubIsoscip-typescript npm . . l10n/`messages.ts`/SubIso# { |
| 268 | return { |
| 269 | defaultscip-typescript npm . . l10n/`messages.ts`/SubIso#default.: '', |
| 270 | currentscip-typescript npm . . l10n/`messages.ts`/SubIso#current.: '', |
| 271 | allscip-typescript npm . . l10n/`messages.ts`/SubIso#all.: [] |
| 272 | }; |
| 273 | } |