ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.51k stars 575 forks source link

Latency when loading the website, because Translation Key appears when user opens our website #1467

Open IbrahimALismail opened 9 months ago

IbrahimALismail commented 9 months ago

Current behavior

There is latency happened when user open our website which Translation Key appears, but in localhost it woks great without latency so I do not know is the problem with server caching. After 8-15 seconds it disappear and works great and correct.

Expected behavior

The website should be opened for user without latency and without appearing Translation Key as the image below and this problem appears with all networks, devices, and browsers IMG_CBC1B0E13740-1 2

How do you think that we should fix this?

Minimal reproduction of the problem with instructions

Environment


ngx-translate version: 14.0.0
Angular version: 15.2.0"

Versions:
   "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

CodeAndWeb commented 9 months ago

Take a look at your network traffic in the browser - you should see then the translation file is loaded.

An option to prevent this from happening is by pre-loading one of the languages:

https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-angular-app-with-ngx-translate#ngx-translate-glitches

If you only have a low number of languages, you might also bundle them all directly in your app instead of using the http loader.