jsverse / transloco

🚀 😍 The internationalization (i18n) library for Angular
https://jsverse.github.io/transloco/
MIT License
2.04k stars 197 forks source link

Transloco prefixes "en" scope when using external library #523

Open iprins opened 3 years ago

iprins commented 3 years ago

Is there an existing issue for this?

Which Transloco package(s) are the source of the bug?

Transloco, Scoped Libs

Is this a regression?

No

Current behavior

Hi,

I'm using Transloco in both the main app and an external library. When I use the external library inside the main app, the main app prefixes the library scope core with en. Therefore the app can't find the correct translation.

Output debug console: image

Here is the used app and library. App: https://github.com/iprins/transloco-main Library: https://github.com/iprins/transloco-lib

Building the library:

npm install
ng build my-lib
npm link

Building the main app:

npm install
npm install @ngneat/transloco-scoped-libs --save-dev
npm link my-workspace
npm run transloco:extract-scoped-libs
ng serve -o

transloco_prefix_en

Output: npm run transloco:extract-scoped-libs image

Expected behavior

I expected the following behavior:

en.core.library

replaced with the correct translation:

Hello Library!

Please provide a link to a minimal reproduction of the bug

https://github.com/iprins/transloco-main

Transloco Config

module.exports = {
  rootTranslationsPath: 'src/assets/i18n/',
  langs: ['en', 'es'],
  keysManager: {},
  scopedLibs: ['my-workspace/dist/my-lib']
};

Please provide the environment you discovered this bug in

Transloco: 3.0.7
Angular: 12.1.2
Node: 16.13.0
Package Manager: 8.1.0 (npm) 
OS: Windows 10

Browser

Firefox 94.0.1
Chrome  95.0.4638.69
Edge 95.0.1020.40

Additional context

I linked the library locally. I haven't tested it with a published library yet.

I would like to make a pull request for this bug

No

dandansoysauce commented 2 years ago

@iprins hey, I think I'm having the same issue, have you solved this?

iprins commented 2 years ago

No I haven't been able to solve this