From d9f05f73f2db5848f2090f366a77ecd87e66c537 Mon Sep 17 00:00:00 2001 From: Florian PAUL Date: Tue, 31 Oct 2023 14:59:40 +0100 Subject: [PATCH] fix(localization): extractor considers internal refs as library refs --- apps/showcase/project.json | 3 ++- .../localization/builders/helpers/localization.generator.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/showcase/project.json b/apps/showcase/project.json index 323e406ad9..adf5d86ad6 100644 --- a/apps/showcase/project.json +++ b/apps/showcase/project.json @@ -190,7 +190,8 @@ "inputs": [ "{projectRoot}/src/assets/locales", "{projectRoot}/src/assets/locales/*", - "{projectRoot}/src/components/**/i18n" + "{projectRoot}/src/components/**/i18n", + "{projectRoot}/src/components/**/*.localization.json" ], "outputs": [ "{options.outputPath}" diff --git a/packages/@o3r/localization/builders/helpers/localization.generator.ts b/packages/@o3r/localization/builders/helpers/localization.generator.ts index 6f6d068718..61eb65d3e9 100644 --- a/packages/@o3r/localization/builders/helpers/localization.generator.ts +++ b/packages/@o3r/localization/builders/helpers/localization.generator.ts @@ -159,7 +159,7 @@ export class LocalizationExtractor { } /** - * Genarate a metadata item from a localization item + * Generate a metadata item from a localization item * * @param loc Localization item * @param key Key of the localization @@ -182,7 +182,7 @@ export class LocalizationExtractor { if (loc.$ref) { const [refPath, refKey] = loc.$ref.split('#/', 2); - if (this.options?.libraries?.some((lib) => refPath.startsWith(lib))) { + if (refPath.startsWith('.') || this.options?.libraries?.some((lib) => refPath.startsWith(lib))) { res.ref = refKey; } else { res.ref = loc.$ref;