rpx-xui-translation 1.2.7 → 1.2.8-alignment-issue
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -142,7 +142,7 @@ class RpxTranslationService {
|
|
|
142
142
|
this.language$ = this.languageSource.asObservable();
|
|
143
143
|
}
|
|
144
144
|
getTranslation$(phrase) {
|
|
145
|
-
return this.getTranslatedData(phrase).pipe(map((t) => t.translation));
|
|
145
|
+
return this.getTranslatedData(phrase.trim()).pipe(map((t) => t.translation));
|
|
146
146
|
}
|
|
147
147
|
getTranslationWithReplacements$(phrase, replacements) {
|
|
148
148
|
// Split the phrase into components first based on replacements
|
|
@@ -167,8 +167,15 @@ class RpxTranslationService {
|
|
|
167
167
|
}
|
|
168
168
|
return this.translate(phrase);
|
|
169
169
|
}
|
|
170
|
+
normalisePhraseSpacing(phrase) {
|
|
171
|
+
if (phrase.trim().length === 0) {
|
|
172
|
+
return phrase;
|
|
173
|
+
}
|
|
174
|
+
return phrase.trim().replace(/[^\S\r\n]+/g, ' ');
|
|
175
|
+
}
|
|
170
176
|
translate(phrase) {
|
|
171
177
|
const lang = this.language;
|
|
178
|
+
const lookupPhrase = this.normalisePhraseSpacing(phrase);
|
|
172
179
|
if (!this.phrases.hasOwnProperty(phrase)) {
|
|
173
180
|
this.phrases[phrase] = new BehaviorSubject({ translation: phrase });
|
|
174
181
|
this.observables[phrase] = this.phrases[phrase].asObservable();
|
|
@@ -177,7 +184,7 @@ class RpxTranslationService {
|
|
|
177
184
|
this.phrases[phrase].next({ translation: phrase });
|
|
178
185
|
}
|
|
179
186
|
else {
|
|
180
|
-
from(liveQuery(() => db.translations.where('[phrase+lang]').equals([
|
|
187
|
+
from(liveQuery(() => db.translations.where('[phrase+lang]').equals([lookupPhrase, lang]).first())).pipe(tap((t) => {
|
|
181
188
|
if (t && !t.isExpired()) {
|
|
182
189
|
this.phrases[phrase].next(t.translation);
|
|
183
190
|
}
|
|
@@ -211,7 +218,8 @@ class RpxTranslationService {
|
|
|
211
218
|
return true;
|
|
212
219
|
}
|
|
213
220
|
load(phrase, lang) {
|
|
214
|
-
|
|
221
|
+
const lookupPhrase = this.normalisePhraseSpacing(phrase);
|
|
222
|
+
if (lang === 'en' || !this.shouldTranslate(lookupPhrase)) {
|
|
215
223
|
this.phrases[phrase].next({
|
|
216
224
|
translation: phrase,
|
|
217
225
|
yes: 'Yes',
|
|
@@ -222,14 +230,14 @@ class RpxTranslationService {
|
|
|
222
230
|
if (!this.requesting.hasOwnProperty(lang)) {
|
|
223
231
|
this.requesting[lang] = [];
|
|
224
232
|
}
|
|
225
|
-
if (this.requesting[lang].indexOf(
|
|
233
|
+
if (this.requesting[lang].indexOf(lookupPhrase) !== -1) {
|
|
226
234
|
return;
|
|
227
235
|
}
|
|
228
236
|
// Prevent making a API call with empty array of phrase
|
|
229
|
-
if (
|
|
237
|
+
if (lookupPhrase.length === 0) {
|
|
230
238
|
return;
|
|
231
239
|
}
|
|
232
|
-
this.requesting[lang].push(
|
|
240
|
+
this.requesting[lang].push(lookupPhrase);
|
|
233
241
|
if (this.requestTimerSubscription) {
|
|
234
242
|
this.requestTimerSubscription.unsubscribe();
|
|
235
243
|
}
|
|
@@ -257,7 +265,9 @@ class RpxTranslationService {
|
|
|
257
265
|
const toAdd = [];
|
|
258
266
|
Object.keys(translations).forEach((p) => {
|
|
259
267
|
toAdd.push(Translation.create(p, lang, translations[p], DateTime.now().plus(this.config.validity).toISO()));
|
|
260
|
-
this.phrases
|
|
268
|
+
Object.keys(this.phrases)
|
|
269
|
+
.filter((phraseKey) => this.normalisePhraseSpacing(phraseKey) === p)
|
|
270
|
+
.forEach((phraseKey) => this.phrases[phraseKey].next(translations[p]));
|
|
261
271
|
});
|
|
262
272
|
db.translations.bulkAdd(toAdd);
|
|
263
273
|
this.requesting[lang] = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpx-xui-translation.mjs","sources":["../../../projects/rpx-xui-translation/src/lib/rpx-language.enum.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.config.ts","../../../projects/rpx-xui-translation/src/lib/db.ts","../../../projects/rpx-xui-translation/src/lib/helpers/match-case/match-case.helper.ts","../../../projects/rpx-xui-translation/src/lib/helpers/replace-placeholders/replace-placeholders.helper.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.service.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translate.pipe.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.module.ts","../../../projects/rpx-xui-translation/src/public-api.ts","../../../projects/rpx-xui-translation/src/rpx-xui-translation.ts"],"sourcesContent":["export type RpxLanguage = 'en' | 'cy';\nexport enum YesOrNoValue {\n YES = 'Yes',\n NO = 'No',\n}\n","export type ValidityDurationSpec = {\n years?: number;\n quarters?: number;\n months?: number;\n weeks?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n milliseconds?: number;\n};\n\nexport class RpxTranslationConfig {\n validity: ValidityDurationSpec;\n baseUrl: string;\n\n debounceTimeMs = 300;\n testMode = false;\n}\n","import Dexie, { Table } from 'dexie';\nimport { DateTime } from 'luxon';\nimport { RpxLanguage } from './rpx-language.enum';\nimport { TranslatedData } from './models/translated-data.model';\n\nexport class Translation {\n id?: number;\n phrase: string;\n lang: RpxLanguage;\n translation: TranslatedData;\n validity: string;\n\n public static create(phrase: string, lang: RpxLanguage, translation: TranslatedData, validity: string): Translation {\n const t = new Translation();\n t.phrase = phrase;\n t.lang = lang;\n t.translation = translation;\n t.validity = validity;\n return t;\n }\n\n isExpired(): boolean {\n return DateTime.fromISO(this.validity) < DateTime.now();\n }\n}\n\nexport class TranslationDB extends Dexie {\n translations: Table<Translation, number>;\n\n constructor() {\n super('RpxTranslations');\n this.version(1).stores({\n translations: '++id, [phrase+lang]'\n });\n this.translations.mapToClass(Translation);\n }\n}\n\nexport const db = new TranslationDB();\n","export const matchCase = (str1: string, str2: string) => {\n if (str1.length === 0 || str2.length === 0) {\n return str2;\n }\n\n if (str1.charAt(0).toUpperCase() === str1.charAt(0)) {\n return `${str2.charAt(0).toUpperCase()}${str2.slice(1)}`;\n }\n return str2.toLowerCase();\n};\n","import { Replacements } from '../../rpx-translation.service';\n\nexport const replacePlaceholders = (input: string, replacements: Replacements) => {\n Object.keys(replacements).forEach((key) => {\n // Ideally use replaceAll here, but that isn't fully compatible with targeted browsers and packaging yet\n const search = `%${key}%`;\n while (input.indexOf(search) !== -1) {\n input = input.replace(search, replacements[key]);\n }\n });\n\n return input;\n};\n\n// Helper method to split the phrase into components, preserving placeholders and text separately\nexport const splitPhraseIntoComponents = (phrase: string, replacements: Record<string, string>): string[] => {\n const result: string[] = [];\n const placeholders = Object.keys(replacements).map((key) => `%${key}%`);\n phrase = phrase.trim();\n\n // Regular expression to match all placeholders in the phrase\n const placeholderRegex = new RegExp(placeholders.join('|'), 'g');\n\n let lastIndex = 0;\n\n // Helper function to split text into spaces and content\n const splitTextIntoComponents = (text: string): string[] => {\n const components: string[] = [];\n const trimmed = text.trim();\n\n if (text.startsWith(' ')) {\n components.push(' ');\n } // Leading space\n if (trimmed) {\n components.push(trimmed);\n } // Content (if any)\n if (text.endsWith(' ')) {\n components.push(' ');\n } // Trailing space\n\n return components;\n };\n\n // Process the phrase by matching placeholders\n phrase.replace(placeholderRegex, (placeholder, offset) => {\n if (offset > lastIndex) {\n // Add text before the placeholder\n result.push(...splitTextIntoComponents(phrase.slice(lastIndex, offset)));\n }\n\n // Add the replacement for the placeholder\n const replacementKey = placeholder.slice(1, -1);\n const replacement = replacements[replacementKey]?.trim();\n if (replacement) {\n result.push(replacement);\n }\n\n lastIndex = offset + placeholder.length; // Update lastIndex\n return ''; // Required by `replace`, but not used here\n });\n\n // Add any remaining text after the last match\n if (lastIndex < phrase.length) {\n result.push(...splitTextIntoComponents(phrase.slice(lastIndex)));\n }\n\n return result;\n};\n\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { liveQuery } from 'dexie';\nimport { DateTime } from 'luxon';\nimport { BehaviorSubject, combineLatest, from, Observable, of, Subscription, timer } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\nimport { db, Translation } from './db';\nimport { matchCase } from './helpers/match-case/match-case.helper';\nimport { splitPhraseIntoComponents } from './helpers/replace-placeholders/replace-placeholders.helper';\nimport { TranslatedData } from './models/translated-data.model';\nimport { RpxLanguage, YesOrNoValue } from './rpx-language.enum';\nimport { RpxTranslationConfig } from './rpx-translation.config';\n\ninterface TranslationsDTO {\n translations: { [from: string]: string | TranslatedData };\n}\n\nexport type Replacements = { [key: string]: string };\n\n@Injectable()\nexport class RpxTranslationService {\n private currentLanguage: RpxLanguage = 'en';\n private languageKey = 'exui-preferred-language';\n\n private phrases: { [phrase: string]: BehaviorSubject<TranslatedData> } = {};\n private observables: { [phrase: string]: Observable<TranslatedData> } = {};\n private requesting: { [lang: string]: string[] } = {};\n private requestTimerSubscription: Subscription | null;\n private languageSource: BehaviorSubject<RpxLanguage> = new BehaviorSubject<RpxLanguage>(this.currentLanguage);\n public language$: Observable<RpxLanguage>;\n\n public get language(): RpxLanguage {\n return this.currentLanguage;\n }\n\n public set language(lang: RpxLanguage) {\n if (lang !== this.currentLanguage) {\n this.currentLanguage = lang;\n this.persistLanguage();\n this.languageSource.next(lang);\n Object.keys(this.phrases).forEach((phrase) => this.translate(phrase));\n }\n }\n\n constructor(\n private config: RpxTranslationConfig,\n private http: HttpClient\n ) {\n const persistedLanguage = this.getPersistedLanguage();\n if (persistedLanguage) {\n this.language = persistedLanguage;\n } else {\n // no language persisted yet, save default\n this.persistLanguage();\n }\n this.language$ = this.languageSource.asObservable();\n }\n\n public getTranslation$(phrase: string): Observable<string> {\n return this.getTranslatedData(phrase).pipe(\n map((t) => t.translation)\n );\n }\n\n public getTranslationWithReplacements$(phrase: string, replacements: Replacements): Observable<string> {\n // Split the phrase into components first based on replacements\n const components = splitPhraseIntoComponents(phrase, replacements);\n\n // Translate each component individually using getTranslatedData and then combine them\n const translatedComponents$ = components.map((component) => this.getTranslatedData(component).pipe(\n map((translatedData) => translatedData.translation) // Extract the translated string\n ));\n\n return combineLatest(translatedComponents$).pipe(\n map((values: string[]) => values.join('')) // Join the strings without any separator\n );\n }\n\n public getTranslationWithYesOrNo$(phrase: string, yesOrNoValue: string): Observable<string> {\n const isYes = yesOrNoValue?.toLowerCase() === YesOrNoValue.YES.toLowerCase();\n\n return this.getTranslatedData(phrase).pipe(map((translatedData: TranslatedData) => {\n const yesOrNoTranslated = isYes ? (translatedData.yes || yesOrNoValue)\n : (translatedData.no || yesOrNoValue);\n return matchCase(yesOrNoValue!, yesOrNoTranslated);\n }\n ));\n }\n\n private getTranslatedData(phrase: string): Observable<TranslatedData> {\n if (this.observables.hasOwnProperty(phrase)) {\n return this.observables[phrase];\n }\n\n return this.translate(phrase);\n }\n\n private translate(phrase: string): Observable<TranslatedData> {\n const lang = this.language;\n if (!this.phrases.hasOwnProperty(phrase)) {\n this.phrases[phrase] = new BehaviorSubject<TranslatedData>({ translation: phrase });\n this.observables[phrase] = this.phrases[phrase].asObservable();\n }\n\n if (lang === 'en') {\n this.phrases[phrase].next({ translation: phrase });\n } else {\n from(liveQuery(() => db.translations.where('[phrase+lang]').equals([phrase, lang]).first())).pipe(\n tap((t) => {\n if (t && !t.isExpired()) {\n this.phrases[phrase].next(t.translation);\n } else {\n if (t) {\n // expired, clean up DB\n db.translations.delete(t.id!);\n }\n this.phrases[phrase].next({\n translation: `${phrase} [Translation in progress]`,\n yes: 'Yes [Translation in progress]',\n no: 'No [Translation in progress]'\n });\n this.load(phrase, lang);\n }\n }),\n ).subscribe(() => ({}));\n }\n\n return this.observables[phrase];\n }\n\n private shouldTranslate(phrase: string): boolean {\n if (!/[a-zA-Z]/.test(phrase)) {\n return false;\n }\n\n if (phrase.includes('[Translation in progress]')) {\n return false;\n }\n\n // check if phrase consists of a placeholder only (eg ${key})\n if (/^\\$\\{[^}]+\\}$/.test(phrase.trim())) {\n return false;\n }\n\n return true;\n }\n\n private load(phrase: string, lang: RpxLanguage): void {\n if (lang === 'en' || !this.shouldTranslate(phrase)) {\n this.phrases[phrase].next({\n translation: phrase,\n yes: 'Yes',\n no: 'No'\n });\n return;\n }\n\n if (!this.requesting.hasOwnProperty(lang)) {\n this.requesting[lang] = [];\n }\n\n if (this.requesting[lang].indexOf(phrase) !== -1) {\n return;\n }\n\n // Prevent making a API call with empty array of phrase\n if (phrase.length === 0) {\n return;\n }\n\n this.requesting[lang].push(phrase);\n\n if (this.requestTimerSubscription) {\n this.requestTimerSubscription.unsubscribe();\n }\n\n this.requestTimerSubscription = timer(this.config.debounceTimeMs).subscribe(() => {\n const url = this.config.baseUrl + `/${lang}`;\n const s = this.http.post<TranslationsDTO>(url,\n {\n phrases: this.requesting[lang]\n }\n )\n .pipe(\n map((t) => t.translations),\n map((translations) => {\n const translatedData: { [from: string]: TranslatedData } = {};\n\n Object.keys(translations).forEach((p) => {\n if (typeof(translations[p]) === 'string') {\n translatedData[p] = { translation: translations[p] as string };\n } else {\n translatedData[p] = translations[p] as TranslatedData;\n }\n });\n\n return translatedData;\n }),\n catchError(() => {\n const translations: { [from: string]: TranslatedData } = {};\n this.requesting[lang].forEach((p) => (\n translations[p] = this.config.testMode ? { translation: `[Test translation for ${p}]` } : { translation: p })\n );\n return of(translations);\n })\n ).subscribe((translations: { [from: string]: TranslatedData }) => {\n const toAdd: Translation[] = [];\n Object.keys(translations).forEach((p) => {\n toAdd.push(Translation.create(p, lang, translations[p], DateTime.now().plus(this.config.validity).toISO()));\n this.phrases[p].next(translations[p]);\n });\n db.translations.bulkAdd(toAdd);\n this.requesting[lang] = [];\n this.requestTimerSubscription?.unsubscribe();\n this.requestTimerSubscription = null;\n s.unsubscribe();\n });\n });\n }\n\n private persistLanguage(): void {\n document.cookie = `${this.languageKey}=${this.currentLanguage}; SameSite=Strict;`;\n }\n\n private getPersistedLanguage(): RpxLanguage {\n console.log(document.cookie.split(';').find((cookie) => cookie.trim().startsWith(this.languageKey + '='))?.split('=')[1].trim());\n return document.cookie.split(';').find((cookie) => cookie.trim().startsWith(this.languageKey + '='))?.split('=')[1].trim() as RpxLanguage;\n }\n}\n","import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { Replacements, RpxTranslationService } from './rpx-translation.service';\n\n@Pipe({\n name: 'rpxTranslate',\n pure: false,\n standalone: false\n})\nexport class RpxTranslatePipe implements PipeTransform, OnDestroy {\n private asyncPipe: AsyncPipe;\n\n constructor(\n private translationService: RpxTranslationService,\n changeDetectorRef: ChangeDetectorRef\n ) {\n this.asyncPipe = new AsyncPipe(changeDetectorRef);\n }\n\n public transform<T = string>(value: T, replacements?: Replacements | null, yesOrNoValue?: string): T | null {\n if (value && typeof value === 'string' && value.toString().trim()) {\n let o: Observable<string>;\n if (replacements) {\n o = this.translationService.getTranslationWithReplacements$(value, replacements);\n } else if (yesOrNoValue) {\n o = this.translationService.getTranslationWithYesOrNo$(value, yesOrNoValue);\n } else {\n o = this.translationService.getTranslation$(value);\n }\n\n const ret = this.asyncPipe.transform<string>(o);\n return ret as unknown as T;\n }\n\n return null;\n }\n\n public ngOnDestroy(): void {\n this.asyncPipe.ngOnDestroy();\n }\n}\n","import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { RpxTranslatePipe } from './rpx-translate.pipe';\nimport { RpxTranslationConfig } from './rpx-translation.config';\nimport { RpxTranslationService } from './rpx-translation.service';\n\n@NgModule({ declarations: [RpxTranslatePipe],\n exports: [RpxTranslatePipe], imports: [], providers: [provideHttpClient(withInterceptorsFromDi())] })\nexport class RpxTranslationModule {\n public static forRoot(config: RpxTranslationConfig): ModuleWithProviders<RpxTranslationModule> {\n return {\n ngModule: RpxTranslationModule,\n providers: [\n {\n provide: RpxTranslationConfig, useValue: config\n },\n RpxTranslationService\n ]\n };\n }\n\n public static forChild(): ModuleWithProviders<RpxTranslationModule> {\n return {\n ngModule: RpxTranslationModule\n };\n }\n}\n","/*\n * Public API Surface of rpx-translation\n */\n\nexport * from './lib/rpx-language.enum';\nexport * from './lib/rpx-translation.config';\nexport * from './lib/rpx-translation.service';\nexport * from './lib/rpx-translate.pipe';\nexport * from './lib/rpx-translation.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.RpxTranslationConfig","i1.RpxTranslationService"],"mappings":";;;;;;;;;;IACY;AAAZ,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,YAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACX,CAAC,EAHW,YAAY,KAAZ,YAAY,GAAA,EAAA,CAAA,CAAA;;MCWX,oBAAoB,CAAA;AAAjC,IAAA,WAAA,GAAA;QAIE,IAAA,CAAA,cAAc,GAAG,GAAG;QACpB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAClB;AAAC;;MCbY,WAAW,CAAA;IAOf,OAAO,MAAM,CAAC,MAAc,EAAE,IAAiB,EAAE,WAA2B,EAAE,QAAgB,EAAA;AACnG,QAAA,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE;AAC3B,QAAA,CAAC,CAAC,MAAM,GAAG,MAAM;AACjB,QAAA,CAAC,CAAC,IAAI,GAAG,IAAI;AACb,QAAA,CAAC,CAAC,WAAW,GAAG,WAAW;AAC3B,QAAA,CAAC,CAAC,QAAQ,GAAG,QAAQ;AACrB,QAAA,OAAO,CAAC;IACV;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE;IACzD;AACD;AAEK,MAAO,aAAc,SAAQ,KAAK,CAAA;AAGtC,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,iBAAiB,CAAC;AACxB,QAAA,IAAI,CAAC,OAAO,CAAC,C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,CAAC,MAA4B,EAAA;QAChD,OAAO;AACL,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE;AAC1C,iBAAA;gBACD;AACD;SACF;IACH;AAEO,IAAA,OAAO,QAAQ,GAAA;QACpB,OAAO;AACL,YAAA,QAAQ,EAAE;SACX;IACH;+GAjBW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAApB,oBAAoB,EAAA,YAAA,EAAA,CAFN,gBAAgB,CAAA,EAAA,OAAA,EAAA,CAC/B,gBAAgB,CAAA,EAAA,CAAA,CAAA;AACf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,aADsB,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAA,CAAA,CAAA;;4FACvF,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAFhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,YAAY,EAAE,CAAC,gBAAgB,CAAC;AAC1C,oBAAA,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE;;;ACPtG;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rpx-xui-translation.mjs","sources":["../../../projects/rpx-xui-translation/src/lib/rpx-language.enum.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.config.ts","../../../projects/rpx-xui-translation/src/lib/db.ts","../../../projects/rpx-xui-translation/src/lib/helpers/match-case/match-case.helper.ts","../../../projects/rpx-xui-translation/src/lib/helpers/replace-placeholders/replace-placeholders.helper.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.service.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translate.pipe.ts","../../../projects/rpx-xui-translation/src/lib/rpx-translation.module.ts","../../../projects/rpx-xui-translation/src/public-api.ts","../../../projects/rpx-xui-translation/src/rpx-xui-translation.ts"],"sourcesContent":["export type RpxLanguage = 'en' | 'cy';\nexport enum YesOrNoValue {\n YES = 'Yes',\n NO = 'No',\n}\n","export type ValidityDurationSpec = {\n years?: number;\n quarters?: number;\n months?: number;\n weeks?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n milliseconds?: number;\n};\n\nexport class RpxTranslationConfig {\n validity: ValidityDurationSpec;\n baseUrl: string;\n\n debounceTimeMs = 300;\n testMode = false;\n}\n","import Dexie, { Table } from 'dexie';\nimport { DateTime } from 'luxon';\nimport { RpxLanguage } from './rpx-language.enum';\nimport { TranslatedData } from './models/translated-data.model';\n\nexport class Translation {\n id?: number;\n phrase: string;\n lang: RpxLanguage;\n translation: TranslatedData;\n validity: string;\n\n public static create(phrase: string, lang: RpxLanguage, translation: TranslatedData, validity: string): Translation {\n const t = new Translation();\n t.phrase = phrase;\n t.lang = lang;\n t.translation = translation;\n t.validity = validity;\n return t;\n }\n\n isExpired(): boolean {\n return DateTime.fromISO(this.validity) < DateTime.now();\n }\n}\n\nexport class TranslationDB extends Dexie {\n translations: Table<Translation, number>;\n\n constructor() {\n super('RpxTranslations');\n this.version(1).stores({\n translations: '++id, [phrase+lang]'\n });\n this.translations.mapToClass(Translation);\n }\n}\n\nexport const db = new TranslationDB();\n","export const matchCase = (str1: string, str2: string) => {\n if (str1.length === 0 || str2.length === 0) {\n return str2;\n }\n\n if (str1.charAt(0).toUpperCase() === str1.charAt(0)) {\n return `${str2.charAt(0).toUpperCase()}${str2.slice(1)}`;\n }\n return str2.toLowerCase();\n};\n","import { Replacements } from '../../rpx-translation.service';\n\nexport const replacePlaceholders = (input: string, replacements: Replacements) => {\n Object.keys(replacements).forEach((key) => {\n // Ideally use replaceAll here, but that isn't fully compatible with targeted browsers and packaging yet\n const search = `%${key}%`;\n while (input.indexOf(search) !== -1) {\n input = input.replace(search, replacements[key]);\n }\n });\n\n return input;\n};\n\n// Helper method to split the phrase into components, preserving placeholders and text separately\nexport const splitPhraseIntoComponents = (phrase: string, replacements: Record<string, string>): string[] => {\n const result: string[] = [];\n const placeholders = Object.keys(replacements).map((key) => `%${key}%`);\n phrase = phrase.trim();\n\n // Regular expression to match all placeholders in the phrase\n const placeholderRegex = new RegExp(placeholders.join('|'), 'g');\n\n let lastIndex = 0;\n\n // Helper function to split text into spaces and content\n const splitTextIntoComponents = (text: string): string[] => {\n const components: string[] = [];\n const trimmed = text.trim();\n\n if (text.startsWith(' ')) {\n components.push(' ');\n } // Leading space\n if (trimmed) {\n components.push(trimmed);\n } // Content (if any)\n if (text.endsWith(' ')) {\n components.push(' ');\n } // Trailing space\n\n return components;\n };\n\n // Process the phrase by matching placeholders\n phrase.replace(placeholderRegex, (placeholder, offset) => {\n if (offset > lastIndex) {\n // Add text before the placeholder\n result.push(...splitTextIntoComponents(phrase.slice(lastIndex, offset)));\n }\n\n // Add the replacement for the placeholder\n const replacementKey = placeholder.slice(1, -1);\n const replacement = replacements[replacementKey]?.trim();\n if (replacement) {\n result.push(replacement);\n }\n\n lastIndex = offset + placeholder.length; // Update lastIndex\n return ''; // Required by `replace`, but not used here\n });\n\n // Add any remaining text after the last match\n if (lastIndex < phrase.length) {\n result.push(...splitTextIntoComponents(phrase.slice(lastIndex)));\n }\n\n return result;\n};\n\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { liveQuery } from 'dexie';\nimport { DateTime } from 'luxon';\nimport { BehaviorSubject, combineLatest, from, Observable, of, Subscription, timer } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\nimport { db, Translation } from './db';\nimport { matchCase } from './helpers/match-case/match-case.helper';\nimport { splitPhraseIntoComponents } from './helpers/replace-placeholders/replace-placeholders.helper';\nimport { TranslatedData } from './models/translated-data.model';\nimport { RpxLanguage, YesOrNoValue } from './rpx-language.enum';\nimport { RpxTranslationConfig } from './rpx-translation.config';\n\ninterface TranslationsDTO {\n translations: { [from: string]: string | TranslatedData };\n}\n\nexport type Replacements = { [key: string]: string };\n\n@Injectable()\nexport class RpxTranslationService {\n private currentLanguage: RpxLanguage = 'en';\n private languageKey = 'exui-preferred-language';\n\n private phrases: { [phrase: string]: BehaviorSubject<TranslatedData> } = {};\n private observables: { [phrase: string]: Observable<TranslatedData> } = {};\n private requesting: { [lang: string]: string[] } = {};\n private requestTimerSubscription: Subscription | null;\n private languageSource: BehaviorSubject<RpxLanguage> = new BehaviorSubject<RpxLanguage>(this.currentLanguage);\n public language$: Observable<RpxLanguage>;\n\n public get language(): RpxLanguage {\n return this.currentLanguage;\n }\n\n public set language(lang: RpxLanguage) {\n if (lang !== this.currentLanguage) {\n this.currentLanguage = lang;\n this.persistLanguage();\n this.languageSource.next(lang);\n Object.keys(this.phrases).forEach((phrase) => this.translate(phrase));\n }\n }\n\n constructor(\n private config: RpxTranslationConfig,\n private http: HttpClient\n ) {\n const persistedLanguage = this.getPersistedLanguage();\n if (persistedLanguage) {\n this.language = persistedLanguage;\n } else {\n // no language persisted yet, save default\n this.persistLanguage();\n }\n this.language$ = this.languageSource.asObservable();\n }\n\n public getTranslation$(phrase: string): Observable<string> {\n return this.getTranslatedData(phrase.trim()).pipe(\n map((t) => t.translation)\n );\n }\n\n public getTranslationWithReplacements$(phrase: string, replacements: Replacements): Observable<string> {\n // Split the phrase into components first based on replacements\n const components = splitPhraseIntoComponents(phrase, replacements);\n\n // Translate each component individually using getTranslatedData and then combine them\n const translatedComponents$ = components.map((component) => this.getTranslatedData(component).pipe(\n map((translatedData) => translatedData.translation) // Extract the translated string\n ));\n\n return combineLatest(translatedComponents$).pipe(\n map((values: string[]) => values.join('')) // Join the strings without any separator\n );\n }\n\n public getTranslationWithYesOrNo$(phrase: string, yesOrNoValue: string): Observable<string> {\n const isYes = yesOrNoValue?.toLowerCase() === YesOrNoValue.YES.toLowerCase();\n\n return this.getTranslatedData(phrase).pipe(map((translatedData: TranslatedData) => {\n const yesOrNoTranslated = isYes ? (translatedData.yes || yesOrNoValue)\n : (translatedData.no || yesOrNoValue);\n return matchCase(yesOrNoValue!, yesOrNoTranslated);\n }\n ));\n }\n\n private getTranslatedData(phrase: string): Observable<TranslatedData> {\n if (this.observables.hasOwnProperty(phrase)) {\n return this.observables[phrase];\n }\n\n return this.translate(phrase);\n }\n\n private normalisePhraseSpacing(phrase: string): string {\n if (phrase.trim().length === 0) {\n return phrase;\n }\n\n return phrase.trim().replace(/[^\\S\\r\\n]+/g, ' ');\n }\n\n private translate(phrase: string): Observable<TranslatedData> {\n const lang = this.language;\n const lookupPhrase = this.normalisePhraseSpacing(phrase);\n if (!this.phrases.hasOwnProperty(phrase)) {\n this.phrases[phrase] = new BehaviorSubject<TranslatedData>({ translation: phrase });\n this.observables[phrase] = this.phrases[phrase].asObservable();\n }\n\n if (lang === 'en') {\n this.phrases[phrase].next({ translation: phrase });\n } else {\n from(liveQuery(() => db.translations.where('[phrase+lang]').equals([lookupPhrase, lang]).first())).pipe(\n tap((t) => {\n if (t && !t.isExpired()) {\n this.phrases[phrase].next(t.translation);\n } else {\n if (t) {\n // expired, clean up DB\n db.translations.delete(t.id!);\n }\n this.phrases[phrase].next({\n translation: `${phrase} [Translation in progress]`,\n yes: 'Yes [Translation in progress]',\n no: 'No [Translation in progress]'\n });\n this.load(phrase, lang);\n }\n }),\n ).subscribe(() => ({}));\n }\n\n return this.observables[phrase];\n }\n\n private shouldTranslate(phrase: string): boolean {\n if (!/[a-zA-Z]/.test(phrase)) {\n return false;\n }\n\n if (phrase.includes('[Translation in progress]')) {\n return false;\n }\n\n // check if phrase consists of a placeholder only (eg ${key})\n if (/^\\$\\{[^}]+\\}$/.test(phrase.trim())) {\n return false;\n }\n\n return true;\n }\n\n private load(phrase: string, lang: RpxLanguage): void {\n const lookupPhrase = this.normalisePhraseSpacing(phrase);\n\n if (lang === 'en' || !this.shouldTranslate(lookupPhrase)) {\n this.phrases[phrase].next({\n translation: phrase,\n yes: 'Yes',\n no: 'No'\n });\n return;\n }\n\n if (!this.requesting.hasOwnProperty(lang)) {\n this.requesting[lang] = [];\n }\n\n if (this.requesting[lang].indexOf(lookupPhrase) !== -1) {\n return;\n }\n\n // Prevent making a API call with empty array of phrase\n if (lookupPhrase.length === 0) {\n return;\n }\n\n this.requesting[lang].push(lookupPhrase);\n\n if (this.requestTimerSubscription) {\n this.requestTimerSubscription.unsubscribe();\n }\n\n this.requestTimerSubscription = timer(this.config.debounceTimeMs).subscribe(() => {\n const url = this.config.baseUrl + `/${lang}`;\n const s = this.http.post<TranslationsDTO>(url,\n {\n phrases: this.requesting[lang]\n }\n )\n .pipe(\n map((t) => t.translations),\n map((translations) => {\n const translatedData: { [from: string]: TranslatedData } = {};\n\n Object.keys(translations).forEach((p) => {\n if (typeof(translations[p]) === 'string') {\n translatedData[p] = { translation: translations[p] as string };\n } else {\n translatedData[p] = translations[p] as TranslatedData;\n }\n });\n\n return translatedData;\n }),\n catchError(() => {\n const translations: { [from: string]: TranslatedData } = {};\n this.requesting[lang].forEach((p) => (\n translations[p] = this.config.testMode ? { translation: `[Test translation for ${p}]` } : { translation: p })\n );\n return of(translations);\n })\n ).subscribe((translations: { [from: string]: TranslatedData }) => {\n const toAdd: Translation[] = [];\n Object.keys(translations).forEach((p) => {\n toAdd.push(Translation.create(p, lang, translations[p], DateTime.now().plus(this.config.validity).toISO()));\n Object.keys(this.phrases)\n .filter((phraseKey) => this.normalisePhraseSpacing(phraseKey) === p)\n .forEach((phraseKey) => this.phrases[phraseKey].next(translations[p]));\n });\n db.translations.bulkAdd(toAdd);\n this.requesting[lang] = [];\n this.requestTimerSubscription?.unsubscribe();\n this.requestTimerSubscription = null;\n s.unsubscribe();\n });\n });\n }\n\n private persistLanguage(): void {\n document.cookie = `${this.languageKey}=${this.currentLanguage}; SameSite=Strict;`;\n }\n\n private getPersistedLanguage(): RpxLanguage {\n console.log(document.cookie.split(';').find((cookie) => cookie.trim().startsWith(this.languageKey + '='))?.split('=')[1].trim());\n return document.cookie.split(';').find((cookie) => cookie.trim().startsWith(this.languageKey + '='))?.split('=')[1].trim() as RpxLanguage;\n }\n}\n","import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { Replacements, RpxTranslationService } from './rpx-translation.service';\n\n@Pipe({\n name: 'rpxTranslate',\n pure: false,\n standalone: false\n})\nexport class RpxTranslatePipe implements PipeTransform, OnDestroy {\n private asyncPipe: AsyncPipe;\n\n constructor(\n private translationService: RpxTranslationService,\n changeDetectorRef: ChangeDetectorRef\n ) {\n this.asyncPipe = new AsyncPipe(changeDetectorRef);\n }\n\n public transform<T = string>(value: T, replacements?: Replacements | null, yesOrNoValue?: string): T | null {\n if (value && typeof value === 'string' && value.toString().trim()) {\n let o: Observable<string>;\n if (replacements) {\n o = this.translationService.getTranslationWithReplacements$(value, replacements);\n } else if (yesOrNoValue) {\n o = this.translationService.getTranslationWithYesOrNo$(value, yesOrNoValue);\n } else {\n o = this.translationService.getTranslation$(value);\n }\n\n const ret = this.asyncPipe.transform<string>(o);\n return ret as unknown as T;\n }\n\n return null;\n }\n\n public ngOnDestroy(): void {\n this.asyncPipe.ngOnDestroy();\n }\n}\n","import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { RpxTranslatePipe } from './rpx-translate.pipe';\nimport { RpxTranslationConfig } from './rpx-translation.config';\nimport { RpxTranslationService } from './rpx-translation.service';\n\n@NgModule({ declarations: [RpxTranslatePipe],\n exports: [RpxTranslatePipe], imports: [], providers: [provideHttpClient(withInterceptorsFromDi())] })\nexport class RpxTranslationModule {\n public static forRoot(config: RpxTranslationConfig): ModuleWithProviders<RpxTranslationModule> {\n return {\n ngModule: RpxTranslationModule,\n providers: [\n {\n provide: RpxTranslationConfig, useValue: config\n },\n RpxTranslationService\n ]\n };\n }\n\n public static forChild(): ModuleWithProviders<RpxTranslationModule> {\n return {\n ngModule: RpxTranslationModule\n };\n }\n}\n","/*\n * Public API Surface of rpx-translation\n */\n\nexport * from './lib/rpx-language.enum';\nexport * from './lib/rpx-translation.config';\nexport * from './lib/rpx-translation.service';\nexport * from './lib/rpx-translate.pipe';\nexport * from './lib/rpx-translation.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.RpxTranslationConfig","i1.RpxTranslationService"],"mappings":";;;;;;;;;;IACY;AAAZ,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,YAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACX,CAAC,EAHW,YAAY,KAAZ,YAAY,GAAA,EAAA,CAAA,CAAA;;MCWX,oBAAoB,CAAA;AAAjC,IAAA,WAAA,GAAA;QAIE,IAAA,CAAA,cAAc,GAAG,GAAG;QACpB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAClB;AAAC;;MCbY,WAAW,CAAA;IAOf,OAAO,MAAM,CAAC,MAAc,EAAE,IAAiB,EAAE,WAA2B,EAAE,QAAgB,EAAA;AACnG,QAAA,MAAM,CAAC,GAAG,IAAI,WAAW,EAAE;AAC3B,QAAA,CAAC,CAAC,MAAM,GAAG,MAAM;AACjB,QAAA,CAAC,CAAC,IAAI,GAAG,IAAI;AACb,QAAA,CAAC,CAAC,WAAW,GAAG,WAAW;AAC3B,QAAA,CAAC,CAAC,QAAQ,GAAG,QAAQ;AACrB,QAAA,OAAO,CAAC;IACV;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,GA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AA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,aADsB,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAA,CAAA,CAAA;;4FACvF,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAFhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,YAAY,EAAE,CAAC,gBAAgB,CAAC;AAC1C,oBAAA,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE;;;ACPtG;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare class RpxTranslationService {
|
|
|
48
48
|
getTranslationWithReplacements$(phrase: string, replacements: Replacements): Observable<string>;
|
|
49
49
|
getTranslationWithYesOrNo$(phrase: string, yesOrNoValue: string): Observable<string>;
|
|
50
50
|
private getTranslatedData;
|
|
51
|
+
private normalisePhraseSpacing;
|
|
51
52
|
private translate;
|
|
52
53
|
private shouldTranslate;
|
|
53
54
|
private load;
|