Overriding strings in server.xx.yml?

(Allen - Watchman Monitoring) #1

Continuing the discussion from Request: Allow easier customization of “outdated browser” message:

This post is intriguing. Currently I have to go back and manually merge my server.en.yml file every time i upgrade discourse.

The subject line [greeting] I need doesn’t work with the current setup, and there are a number of other changes I want to have.

Is there an example of how I could use such a plugin to do the overriding for me?

(Jeff Atwood) #2

String overriding comes up a fair bit and we do eventually want to support this. But it is hard, or so I have been told.

(Sam Saffron) #3

The plugin approach is not too hard, all you need is a plugin with 2 files really. @riking should put a demo github repo up :slight_smile:

(Paul Apostolos) #4

If @riking ever did create a demo, I can’t find it.

I also would like to override some of the strings in our server.xx.yml files.

(Kane York) #5

Here’s my demo.

This should work, if it doesn’t we should change the code so it does.

FILE: app.yml or web.yml or other container definition

    - exec:
        cd: $home/plugins
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          #- git clone https://github.com/riking/docker_manager.git -b unbuffer-2
          - git clone https://github.com/werweisswas/discourse-plugin-tagger.git

    - exec: mkdir -p $home/plugins/locale_override/config/locales
    - file:
      path: $home/plugins/locale_override/plugin.rb
      contents: |
        # Locale override plugin
    - file:
      path: $home/plugins/locale_override/config/locales/client.en.yml
      contents: |
            last_seen: "Last seen"
              title: "Sign in"
    - file:
      path: $home/plugins/locale_override/config/locales/server.en.yml
      contents: |
          log_in: "Sign in"
          # disguise the error
          spamming_host: "Body is invalid; try to be a little more descriptive"
            title: "Welcome to the VIP Lounge"
            body: |

              Congratulations! :confetti_ball:

              If you can see this topic, you were recently promoted to **regular** (trust level 3).

              You can now …

              * Edit the title of any topic
              * Change the category of any topic
              * Have all your links followed ([automatic nofollow](http://en.wikipedia.org/wiki/Nofollow) is removed)
              * Access a private Lounge category only visible to users at trust level 3 and higher
              * Hide spam with a single flag

              Here's the [current list of fellow regulars](/badges/3/regular). Be sure to say hi.

              Thanks for being an important part of the Meta community!

              (For more information on trust levels, [see this topic][trust]. Please note that only members who continue to meet the requirements over time will remain regulars.)

              [trust]: https://meta.discourse.org/t/what-do-user-trust-levels-do/4924

Customizing Localizations?
Customize email content
Unable to Modify Email Sent Out Via Invites
Any way to customize message for "New" and "Unread" when nothing appears?
(Allen - Watchman Monitoring) #6

The issue with this is that the plugin would have to get changed with almost every release of discourse. I’d welcome every change because it means another improvement but it would make upgrading a matter of testing a plugin each time.

Currently I just grab a copy of the current server.en.yml, start the upgrade, and compre what it was changed to after the git-reset.

This process takes maybe 30-40 seconds (and the number of things I need to change lessens every month, so it’s just getting better) and I’m done before the final restart happens.

Now my welcome emails are the way I like them, and the subject lines are too my liking.

I’ve got open requests on both of those features, but for now, using sftp to get the files & edit them is pretty painless.

(Mittineague) #7

You don’t need to compare a complete copy eg,

    title: "Sorry, try these links instead."

      title: "Baby Bears"
      yaxis: "Number of Cubs"

only over-rides certain text values, all others will be the default.

(Allen - Watchman Monitoring) #8

As the wording & subject lines evolve, it’s much faster to manually compare the files, then wonder how to stringmatch the various multi-line string/paragraphs.

Making a plugin would be like playing whack-a-mole.

(Allen - Watchman Monitoring) #9

update… with the bulk of the emails editable, yes, @riking’s example is just right for fixing up the little bits like:

continue: "Continue to %{site_name}" when we’d rather have a more complete sentence.