Here’s a plugin that will localize any category that is named after a locale, to that locale.
https://github.com/scossar/localized-categories
For example, if you create a category called ‘ar’ all its topics and category lists will be localized to ‘ar’ and be displayed rtl. To see the change in the locale you have to refresh your browser. Possibly, when the locale changes there should be a notice that lets people know they need to refresh their browser to see it.
The basic logic is:
category_sym = @category.name.to_sym
if I18n.available_locales.include? category_sym
I18n.locale = category_sym
end
Edit: this plugin has not been tested since 2016. The approach it uses could be useful for some sites, so I’ll leave the plugin in my Github repo as example code.