Access the Locale in Ruby in CSS files

后端 未结 1 450
抹茶落季
抹茶落季 2021-01-20 01:12

So i am using CSS, JS and Ruby for a project. Now i have my location set etc, in ruby but i want to access them on my css files. This is to customize views for a particular

1条回答
  •  隐瞒了意图╮
    2021-01-20 02:06

    You can add current locale to html tag as lang. For example

    %html{lang: I18n.locale}
     or 
    

    and add specific language style with language prefix

    html[lang="en"] {
      # for english part
    }
    
    html[lang="ru"] {
      # for russian part
    }
    

    also you can change behavior existing class

    .test-title {
      html[lang="en"] & {
        // specific english style
      }
    }
    

    0 讨论(0)
提交回复
热议问题