Skip to content

Commit

Permalink
fix(localization): extractor considers internal refs as library refs (#…
Browse files Browse the repository at this point in the history
…987)

## Proposed change

<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that is required for this change. -->

## Related issues

- 🐛 Fixes #(issue)
- 🚀 Feature #(issue)

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
  • Loading branch information
fpaul-1A authored Oct 31, 2023
2 parents f52a3fb + d9f05f7 commit 9ea8257
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/showcase/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 9ea8257

Please sign in to comment.