How to add custom css file specific to language or store in magento2

The question:

in my project i have 2 store one is for en other is ar_KW , i am creating new locale called ar_KW
when i run magento setup:static-content:deploy ar_KW

it will create a ar_KW folder in pub static folder which is same as en_US but i need to add new custom css file only for Arabic store that is ar_KW store but when i switch to en_US store that custom css should not load , in that case how to do it ?

and also for specific language(less variable value need to change in that case how to do it? )

example :- i have two view one is en other one is Arabic that i ar when i switch store between store css class called direction value should change from float left to right and visa-versa that is less variable value will change based on locale in that case how to do it in magento 2

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Please, see this answer –
If you have localized images in specified folder (for example, in the theme), these images will be used instead of default ones.
Same should be possible for css or less files.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment