| 1 | // |
| 2 | // Copyright 2017-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 locale file providing namespace and utilities. |
| 18 | * @author [email protected] (Volker Sorge) |
| 19 | */ |
| 20 | |
| 21 | import { LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE. } from './locale.js'scip-typescript npm . . l10n/`locale.ts`/; |
| 22 | import { Combinerscip-typescript npm . . l10n/`transformers.ts`/Combiner#, Combinersscip-typescript npm . . l10n/`transformers.ts`/Combiners. } from './transformers.js'scip-typescript npm . . l10n/`transformers.ts`/; |
| 23 | |
| 24 | /** |
| 25 | * Translation for count word in superbrief nesting description. |
| 26 | * |
| 27 | * @param count The counting parameter. |
| 28 | * @returns The corresponding string. |
| 29 | */ |
| 30 | export function nestingToStringscip-typescript npm . . l10n/`locale_util.ts`/nestingToString().(countscip-typescript npm . . l10n/`locale_util.ts`/nestingToString().(count): number): string { |
| 31 | switch (countscip-typescript npm . . l10n/`locale_util.ts`/nestingToString().(count)) { |
| 32 | case 1: |
| 33 | return LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS..ONCE || ''; |
| 34 | case 2: |
| 35 | return LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS..TWICE; |
| 36 | default: |
| 37 | return countscip-typescript npm . . l10n/`locale_util.ts`/nestingToString().(count).toStringscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Number#toString().(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Generates a root ending message by combining the end message (postfix) with |
| 43 | * the index. Example: Start Root Cubic ... End Root Cubic. |
| 44 | * |
| 45 | * @param postfix The postfix. |
| 46 | * @param index The index. |
| 47 | * @returns The combined string, postfix plus index. |
| 48 | */ |
| 49 | export function combinePostfixIndexscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfixscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfix): string, indexscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(index): string): string { |
| 50 | return postfixscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfix) === LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS..ROOTINDEX || |
| 51 | postfixscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfix) === LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..MSscip-typescript npm . . l10n/`messages.ts`/Messages#MS..INDEX |
| 52 | ? postfixscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfix) |
| 53 | : postfixscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(postfix) + ' ' + indexscip-typescript npm . . l10n/`locale_util.ts`/combinePostfixIndex().(index); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Localizes the font name. |
| 58 | * |
| 59 | * @param font The font name. |
| 60 | * @returns The localized font name. |
| 61 | */ |
| 62 | export function localFontscip-typescript npm . . l10n/`locale_util.ts`/localFont().(fontscip-typescript npm . . l10n/`locale_util.ts`/localFont().(font): string): string { |
| 63 | return extractStringscip-typescript npm . . l10n/`locale_util.ts`/extractString().(LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..fontscip-typescript npm . . l10n/`messages.ts`/Messages#font.[fontscip-typescript npm . . l10n/`locale_util.ts`/localFont().(font)], fontscip-typescript npm . . l10n/`locale_util.ts`/localFont().(font)); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Localizes the role name. |
| 68 | * |
| 69 | * @param role The role name. |
| 70 | * @returns The localized role name. |
| 71 | */ |
| 72 | export function localRolescip-typescript npm . . l10n/`locale_util.ts`/localRole().(rolescip-typescript npm . . l10n/`locale_util.ts`/localRole().(role): string): string { |
| 73 | return extractStringscip-typescript npm . . l10n/`locale_util.ts`/extractString().(LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..rolescip-typescript npm . . l10n/`messages.ts`/Messages#role.[rolescip-typescript npm . . l10n/`locale_util.ts`/localRole().(role)], rolescip-typescript npm . . l10n/`locale_util.ts`/localRole().(role)); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Localizes the enclose name. |
| 78 | * |
| 79 | * @param enclose The enclose name. |
| 80 | * @returns The localized enclose name. |
| 81 | */ |
| 82 | export function localEnclosescip-typescript npm . . l10n/`locale_util.ts`/localEnclose().(enclosescip-typescript npm . . l10n/`locale_util.ts`/localEnclose().(enclose): string): string { |
| 83 | return extractStringscip-typescript npm . . l10n/`locale_util.ts`/extractString().(LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..MESSAGESscip-typescript npm . . l10n/`locale.ts`/Locale#MESSAGES..enclosescip-typescript npm . . l10n/`messages.ts`/Messages#enclose.[enclosescip-typescript npm . . l10n/`locale_util.ts`/localEnclose().(enclose)], enclosescip-typescript npm . . l10n/`locale_util.ts`/localEnclose().(enclose)); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Extracts a string from a combined message entry. |
| 88 | * |
| 89 | * @param combiner The combined message |
| 90 | * @param fallback The fallback if no string can be extracted. |
| 91 | * @returns The name. |
| 92 | */ |
| 93 | function extractStringscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combinerscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combiner): string | [string, string], fallbackscip-typescript npm . . l10n/`locale_util.ts`/extractString().(fallback): string) { |
| 94 | if (combinerscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combiner) === undefined) { |
| 95 | return fallbackscip-typescript npm . . l10n/`locale_util.ts`/extractString().(fallback); |
| 96 | } |
| 97 | return typeof combinerscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combiner) === 'string' ? combinerscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combiner) : combinerscip-typescript npm . . l10n/`locale_util.ts`/extractString().(combiner)[0]; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Retrieves font value and combiner for the current locale. |
| 102 | * |
| 103 | * @param font The font of an alphabet. |
| 104 | * @returns The localised font value plus a combiner. |
| 105 | */ |
| 106 | export function localeFontCombinerscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font): string | [string, string]): { |
| 107 | fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:font.: string; |
| 108 | combinerscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:combiner.: Combinerscip-typescript npm . . l10n/`transformers.ts`/Combiner#; |
| 109 | } { |
| 110 | return typeof fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font) === 'string' |
| 111 | ? { fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:font.: fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font), combinerscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:combiner.: LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..ALPHABETSscip-typescript npm . . l10n/`locale.ts`/Locale#ALPHABETS..combinerscip-typescript npm . . l10n/`messages.ts`/Alphabets#combiner. } |
| 112 | : { |
| 113 | fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:font.: fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font)[0], |
| 114 | combinerscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().typeLiteral1:combiner.: |
| 115 | LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..COMBINERSscip-typescript npm . . l10n/`locale.ts`/Locale#COMBINERS.[fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font)[1]] || |
| 116 | Combinersscip-typescript npm . . l10n/`transformers.ts`/Combiners.[fontscip-typescript npm . . l10n/`locale_util.ts`/localeFontCombiner().(font)[1]] || |
| 117 | LOCALEscip-typescript npm . . l10n/`locale.ts`/LOCALE..ALPHABETSscip-typescript npm . . l10n/`locale.ts`/Locale#ALPHABETS..combinerscip-typescript npm . . l10n/`messages.ts`/Alphabets#combiner. |
| 118 | }; |
| 119 | } |