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

Support @ngx-translate for displayText #36

Open
hkvstore opened this issue Apr 21, 2018 · 2 comments
Open

Support @ngx-translate for displayText #36

hkvstore opened this issue Apr 21, 2018 · 2 comments
Assignees

Comments

@hkvstore
Copy link

hkvstore commented Apr 21, 2018

I'd like to suggest changing displayText from string to BehaviorSubject<string> to support dynamic change of display text and @ngx-translate, the HTML markup will become like, e.g.

<span *ngIf="option.displayText | async as menuText">{{ menuText | translate }}</span>
@sebaferreras
Copy link
Owner

Thanks @hkvstore for your suggestion! 😄

I agree, @ngx-translate support must be added to the component, but using the translate pipe in the view will force everyone to install it so it may not be the better way to add support for translations.

I'm thinking in creating a custom pipe, that could use the injector to check if the TranslateService is available, an if it is available, then use it to get the translation. What do you think @hkvstore ?

@hkvstore
Copy link
Author

hkvstore commented Apr 22, 2018

Yes, that will be even better. Thanks. I however still hope that displayText can be changed dynamically even if TranslateService is not available.

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

2 participants