transloco icon indicating copy to clipboard operation
transloco copied to clipboard

Transloco prefixes "en" scope when using external library

Open iprins opened this issue 4 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

iprins avatar Nov 04 '21 15:11 iprins

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

dandansoysauce avatar Feb 03 '22 21:02 dandansoysauce

No I haven't been able to solve this

iprins avatar Mar 23 '22 08:03 iprins