jsverse / transloco

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

Bug(transloco-optimize): Translation broken in production #739

Open utpaulBS23 opened 5 months ago

utpaulBS23 commented 5 months ago

Is there an existing issue for this?

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

Optimize

Is this a regression?

Yes

Current behavior

I pass configuration

{
                availableLangs: [
                    { id: 'en', label: 'English' },
                    { id: 'nb', label: 'Norwegian' }
                ],
                defaultLang: 'en',
                fallbackLang: 'en',
                reRenderOnLangChange: true,
                prodMode: true,
                flatten: {
                    aot: !isDevMode()
                }
            }
        }

And install optimize plugin and added script on package.json

  "transloco:optimize": "transloco-optimize dist/wellbook/assets/i18n",
    "build:prod": "ng build --configuration production && npm run transloco:optimize", 

But still i get broken translation issue. I attach screen shot here

Screenshot 2024-01-07 at 3 32 09 PM

Expected behavior

Should be load translation as i share on menu

Screenshot 2024-01-07 at 6 39 31 PM

Should be work on production

Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.

Just have that conent

Transloco Config

{
                availableLangs: [
                    { id: 'en', label: 'English' },
                    { id: 'nb', label: 'Norwegian' }
                ],
                defaultLang: 'en',
                fallbackLang: 'en',
                reRenderOnLangChange: true,
                prodMode: true,
                flatten: {
                    aot: !isDevMode()
                }
            }
        }

Please provide the environment you discovered this bug in

Transloco: 6.0.4
Angular: 16.2.0
Node: v18.17.0
Package Manager: NPM
OS: ubuntu-latest

Browser

Chrome

No response

Additional context

No response

I would like to make a pull request for this bug

Yes 🚀

shaharkazaz commented 5 months ago

This is a very general issue. Please provide a reproduction link as requested when opening an issue, IDK what I should see in this screenshot Please share a before & after example.

utpaulBS23 commented 5 months ago

@shaharkazaz i added expected screenshot. As i saw this issue is only fix for window. Need to fix for ubuntu as well https://github.com/ngneat/transloco/pull/687

shaharkazaz commented 5 months ago

@utpaulBS23 If you understand the issue, you are welcome to open a PR 👍

utpaulBS23 commented 5 months ago

@shaharkazaz i will create a demo project for that issue