Enable group to change translations in Discourse site texts

Okay, I share the Discourse Helper reply for those who are interested and have the knowledge for do it :slight_smile:

I think that’s essential to improve the UI/UX (modernize our forums), like the composer, AI, and the latest improvements we have seen.

The english used is super neutral/plane and it makes sense but -in my case- the spanish translations are not good by default.

Editing strings on the Discourse UI is OK but really time-consuming, and I just want to delegate this task.

I understand is not possible to download all the strings as JSON file but the edited texts?

Downloading all language texts and editting the file should be a work-around to get the desired result on 1/5 of the time.


High-Level Plugin Structure

  1. Create Plugin Skeleton

    • Use:

      rake plugin:create[custom-site-texts-group]
      
  2. Backend: Extend Permissions

    • Override the relevant controller, e.g. Admin::SiteTextController, to allow members of your custom group(s) to access text editing endpoints.

    • You might use something similar to:

      add_to_class(:admin_constraint, :matches?) do |request|
        user = ... # load current user from request
        return true if user.admin?
        # Check for your group's membership
        group_id = Group.find_by(name: 'yourgroupname')&.id
        return user.group_ids.include?(group_id)
      end 
      

      This is only illustrative—you will need to locate the correct permission check and ensure it’s only scoped to localization editing, not full admin.

  3. Frontend: Expose UI to Group Members

    • Use PluginAPI to inject UI for your group’s members where admins have “Customize Site Texts”.

    • Hide this UI for other users.

  4. Security

    • Re-check permissions in any overridden controller actions and routes. Never trust client-side checks.