تمكين المجموعة من تغيير الترجمات في نصوص موقع Discourse

I wonder if it’s possible to enable text editting on groups more than admins. Moderators at least?

We want to use a different tone and use our own words on our community, in order to get closure with our users.

إعجابَين (2)

You can give permission to groups to edit posts made by others by changing the site setting Edit all post groups — is this what you’re looking for?

إعجاب واحد (1)

Hello, thanks for your reply. I’m looking to enable Discourse text edits (aka localization, language strings) :slight_smile:

I understand that currently it’s only enabled for admins, and I think it’s a function more feasible for moderators/editors.

إعجاب واحد (1)

oh thank you for clarifying, this isn’t currently possible

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.