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

Hiding untranslated keys #520

Open
Meldinoor opened this issue Apr 25, 2017 · 5 comments
Open

Hiding untranslated keys #520

Meldinoor opened this issue Apr 25, 2017 · 5 comments

Comments

@Meldinoor
Copy link

I'm submitting a ... (check one with "x")

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request

Current behavior
My keys are visible for a brief period before translations are loaded. This has an ugly effect on the loading of my website.

Expected/desired behavior
An attribute could be used to show translated elements. My css could for example look like this:

[translate]:not([translated]) {
display: none;
}

Then when the translated attribute is added the translated text will become visible.

What is the motivation / use case for changing the behavior?
To make it simple to hide keys until translation is complete.

@parker-mike
Copy link

May be there is an option to hold the loading stage on the screen until translations are loaded?
I mean that when the application starts and not functioning yet, the browser shows the contents of the app root tags, so maybe we can use some hooks to load the translations at this stage, so when the app starts rendering the page and replaces the innerHtml it would have the translations and won't show the keys... Is there any way of doing it?

@Meldinoor
Copy link
Author

I've implemented my own hack to solve this problem for now, but I don't have the time or the know-how to write proper tests and make a pull-request.
This is how I solved it:
In translate.directive.js, in the updateValue function, I added one line of code:

_this.setContent(node, _this.key ? node.currentValue : node.originalContent.replace(key, node.currentValue)); node.parentElement.setAttribute('translated', ''); <-- this is what I added _this._ref.markForCheck();

@gitnik
Copy link

gitnik commented Jan 25, 2018

is there any update on this? Is this expected behaviour that will not be changed or is it something that is under consideration?

@haskelcurry
Copy link

Any updates?

1 similar comment
@cjkumaresh
Copy link

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants