-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How to set RTL as the default layout in new angular project #277
Comments
@aadenfr you're almost there. <!DOCTYPE html>
<html lang="en" dir="rtl">
...
</html> See also: https://coreui.io/bootstrap/docs/getting-started/rtl/#ltr-and-rtl-at-the-same-time |
yes, it works 100% what about making dropdown switching lang do I need to implement that in scss like the dark/night feature or in a separate component?can you provide some help here! |
@aadenfr It depends on your approach to language switching in your application. Whether you intend to use the built-in Angular Internationalization (https://angular.dev/guide/i18n) or a third-party dynamic runtime language switching solution (for example: https://ngx-translate.org), the method of switching languages is a secondary concern. |
thanks for the comment , yes i'm planning to use ngx-translate , i just want a start do that using this combination of coreui prebuilts feature and ngx-translate |
@aadenfr |
after some research if found that there is a service called RtlService exists in @coreui/angular/lib/service/... but i don't know how to use but i try with this stackblitz guide
can i use this with ngx-translate to toggle the dir or there is same other best practices im missing? |
RtlService checks if the text direction of a document or an element is
If you need both $enable-ltr: true;
$enable-rtl: true;
@import "@coreui/coreui/scss/coreui"; on upcoming v5.4 we support sass modules: @use "@coreui/coreui/scss/coreui" as * with (
$enable-ltr: true,
$enable-rtl: true
); Sass is a CSS preprocessor that converts Sass files into normal CSS that your web application can consume. The |
hello again I ended up with the following implementation to make it work ... is not ideal but I give it a try ... if someone needs it in the future. 1- update _variables.scss and keep only '"html lang="en"' in index.html 2- create new LanguageService
3- in the DefaultHeaderComponent
4- DefaultHeaderComponent template (you can make it with dropdow also)
|
I'm trying to set RTL as the default layout but I am facing some issues with that, here is my try from the style.scss file
is there any way to make a switch lang in the navbar between Arabic/English
The text was updated successfully, but these errors were encountered: