Internationalization of stylesheets

104 views
Skip to first unread message

Norm Scherer

unread,
Oct 15, 2019, 5:25:41 PM10/15/19
to Ruby on Rails: Talk
My application supports a dozen locales.  I use different stylesheets for each locale because things differ and it looks better if the styles fit the locale.
Currently I use <%= stylesheet_link_tag "/stylesheets/#{I18n.locale}.css", :media => "screen" %> in my layouts as needed.
This works but I do not get the advantages of fingerprinting and minification that one would get with assets.

Is there a better way to do this?

Thanks
Norm

Ariel Juodziukynas

unread,
Oct 15, 2019, 8:47:49 PM10/15/19
to rubyonra...@googlegroups.com
Do the style for each locale differ a lot?

Personally, I would use a class or attribute to se the language on the body or the html element and put all languages on the same file and add the language as the selector for the things that should be different. It the difference is little you shouldn't have any problem with the size since minification and gzip compression should be enough.

If the styles are too different, I'm not sure.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/24f69bd7-9e1f-785c-90e3-46f3c3eb56b4%40earthlink.net.
Reply all
Reply to author
Forward
0 new messages