Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: avoid displaying the key until loading #170

Closed
wants to merge 3 commits into from

Conversation

rozsazoltan
Copy link
Contributor

If the page is not loaded based on SSR, then when the language file loading takes even slightly longer than the rest of the frontend, the key briefly appears for a very short time. This creates a sensation of "vibration". It would be much better if the wTrans (and other dependent functions) function returned nothing until the loading is complete.

I've made a video (not the most professional, but it illustrates the difference), playing back the loading process at 0.1x speed.

laravel-vue-i18n-loading-text-slowdown.mp4

@rozsazoltan
Copy link
Contributor Author

rozsazoltan commented Feb 24, 2024

Hm, GitHub won't let me place the PR in Draft. The implementation is still half-done / incomplete.

Maybe we should complement it with another global setting, which by default allows displaying the key.

showKeyWhileLoading = true // (default)

And for a false value, it would return an empty string.

Althought displaying the key would only be advantageous in the main (99% English) language, and only in cases where the key covers entire words/sentences that are meaningful on their own, rather than just a structure like section.example.key.to.text.

@xiCO2k
Copy link
Owner

xiCO2k commented Feb 26, 2024

this is a breaking change :(

I could consider that if we make that an option like: hiddenBeforeLoaded, that way we can have this on a Minor Release.

Thanks for the PR.

@xiCO2k xiCO2k closed this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants