Created
March 31, 2020 08:12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getLocaleDirection, registerLocaleData } from '@angular/common'; | |
import { LOCALE_ID } from '@angular/core'; | |
import localeAr from '@angular/common/locales/ar'; | |
... | |
constructor(@Inject(LOCALE_ID) locale) { | |
getLocaleDirection(locale); // 'derecha a izquierda' or 'izquierda a derecha' usando el idioma actual | |
registerLocaleData(localeAr, 'ar-ae'); | |
getLocaleDirection('ar-ae'); // 'derecha a izquierda' | |
// Ahora puedes usar dirección actual en tu aplicación.. | |
// Puede especificar condicionalmente una URL de imagen, por ejemplo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment