-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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(admin-ui): Add rtl compatibility to some admin-ui components #2451
Conversation
|
|
|
…it test compatibility
|
Hi, export class NotificationComponent implements OnInit {
direction: 'ltr' | 'rtl';
constructor(private localStorageService: LocalStorageService, private i18nService: I18nService) {
this.direction = this.i18nService.isRTL(this.localStorageService.get('uiLanguageCode');
}
} Can you try to refactor like this and see if that works? That would cut down on the amount of code we need to add quite significantly. |
Yeah, I'll give it a shot. but I think there may be cases that setting the direction inside constructor wouldn't take effect when user try change the locale/language at runtime/asynchronously. Actually we have to update the Also note that, as an alternate solution, we can create some sort of |
My thinking was that since the language can only be set in 1 place (the language dialog) then it might be ok to assume a static value for a given component. But is this causes edge-cases then my 2nd choice would indeed be to encapsulate the observable logic in a shared service. |
Thank you for your reply. I will soon update the strategy on accessing |
import { LocalizationDirectionType, LocalizationService } from '../../providers/localization/localization.service';
export class NotificationComponent implements OnInit {
direction$: LocalizationDirectionType;
constructor(private localizationService: LocalizationService) { }
ngOnInit(): void {
this.direction$ = this.localizationService.direction$;
}
} |
Beautiful refactor, thank you! |
Its my pleasure! 👌 |
ModalDialogComponent
is now supporting dynamic direction (ltr/rtl) based on thelanguage
&locale
provided bydataService
.