Subforum with different language (help wanted)

A plugin like this might work for you. It’s checking the request path to see if you are on the category page /c/arabic or if you are on a topic page that has the english word ‘arabic’ in the title - ‘(arabic)’ (in brackets) will work. If so, it sets the local to ‘ar’ and displays the page right-to-left.

People will have to refresh the page to get the rtl stylesheet, and refresh it again when they go back to wanting a ltr stylesheet.

# name: arabic-topics
# about: set locale for specific topics and categories

after_initialize do

  ApplicationController.class_eval do

    def set_locale
      if /^\/c\/arabic/.match(request.path) || /^\/t\/arabic/.match(request.path)
        I18n.locale = 'ar'
      else
        if !current_user
          if SiteSetting.set_locale_from_accept_language_header
            I18n.locale = locale_from_header
          else
            I18n.locale = SiteSetting.default_locale
          end
        else
          I18n.locale = current_user.effective_locale
        end
      end
      I18n.ensure_all_loaded!
    end
    
  end
end

I don’t know Arabic. Those are random letters :stuck_out_tongue:

Maybe it will be possible to append the word ‘Arabic’ to any topic created in the arabic category. I can look at this some more later if you think this approach makes sense.

Edit: it looks like there is a more straightforward way to do this. I’ll try making something for it tomorrow.