Skip to content

Conversation

@rbalet
Copy link
Collaborator

@rbalet rbalet commented Aug 4, 2025

Description

Enable the possibility to hide the keys before they have been translated.

@rbalet
Copy link
Collaborator Author

rbalet commented Aug 4, 2025

@CodeAndWeb Note, I can also do the directive, just didn't wanted to add more time if you wouldn't accept this one or if you have a better implementation

@CodeAndWeb
Copy link
Member

CodeAndWeb commented Aug 5, 2025

I think this solution is incomplete: It does not work for - e.g. instant() or directives.

A more complete solution might be to use a MissingTranslationHandler instead. E.g. we could create a

export class SilentMissingTranslationHandler implements MissingTranslationHandler {
    handle(params: MissingTranslationHandlerParams): string {
        return "";
    }
}

and replace it with the "real" one after the first language or fallback language was loaded. I'd prefer this solution since it's more in one place instead of implementing the logic in several places.

Uses could also easily use a handler like this themselves.
It's also possible to register to onLangChange() and update the flag to show the translation keys.

@CodeAndWeb CodeAndWeb closed this Aug 5, 2025
@CodeAndWeb CodeAndWeb reopened this Aug 5, 2025
@rbalet
Copy link
Collaborator Author

rbalet commented Aug 5, 2025

@CodeAndWeb yes you're right and I like the idea :). Shall I let you implement it, as you're more familiar with the missing handler?

If not you can assign it to me and I'll look into it

CodeAndWeb added a commit that referenced this pull request Nov 23, 2025
#1579 #689

Using a MissingTranslationHandler hat simply returns an empty string prevents displaying translation keys if the language was not yet loaded.
@CodeAndWeb CodeAndWeb closed this Nov 23, 2025
@rbalet
Copy link
Collaborator Author

rbalet commented Nov 25, 2025

@CodeAndWeb Indeed, we already have workaround, but this implementation will let you delete the entire page, which is quite long, in favour of a simple hideBeforeDisplay: true settings.

Or what is going against it ?

@CodeAndWeb
Copy link
Member

It does not replace the page. Options 1 and 2 are valid solutions to the problem, too - maybe even better than displaying an empty text - which event might introduce bigger content shift after the strings are loaded.
It puts more weight on our shoulders for a solution that can be solved with minimum effort.

What I would accept is adding a useEmptyStringIfNotFound or similar as parameter for the MissingTranslationHandler.
That has the same effect and keeps the changes to a minimum.

@CodeAndWeb CodeAndWeb reopened this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants