Translation updates related questions

(Kai) #1

Given I have a running Discourse instance and the default locale is not English. When I find a missing translation I could quick fix it like this:

  1. SSH into the Docker container
  2. add the missing string in config/locales/*.yml
  3. pre-compile the assets
  4. restart the app

With one of the next Discourse updates my changes will be lost because the files get overwritten. To prevent this I’ve got two options:

  1. add it to the official locales via Transifex
  2. put it into a file → wget it in the after_code hook in containers/app.yml → overwrite the original file

Question: Is this correct or am I missing some point?

Another question: Are there any plans to completely get rid of the locale files? All strings could be stored in the database instead. This way all strings could be customised in the admin area.

(Jeff Atwood) #2

There are no plans to move locales to db.

(Kai) #3

OK. But what about the update process … is my description correct?

More important: Is there an easier way? I have no problems with this way but I can imagine non-dev folks could.

(Arpit Jalan) #4

The best way to update translation is to submit them on Transifex, that’s the only officially supported way to get translations persisted.

Transifex interface is very user-friendly IMO, view this blog post for more details.

(Kai) #5

Transifex might be the best way to update the official translations. But you can’t create / update custom translations, can you? Custom translation’s are needed for example to fix typos as soon as possible or to have a different wording as the official one.

(Jong Eun Lee) #6

I agree :

I just want to find a way to apply latest translation data from transifex ASAP, not a waiting for Discourse repository update translations.


I’m also interested in this. Is there a clean way to do it?

I recently put a lot of effort to improve the French locale that had many untranslated strings and mistakes. I would like to see the changes go live quickly.

(Jong Eun Lee) #8

Sorry for late response.

I used below way. But I’m not sure it work with latest version :slight_smile:

  1. Connect Server and move to /var/discourse/

  2. run ./launch enter [APPLICATION_NAME]

  3. install pip

  4. install trsnsifex-client

     pip install transifex-client
  5. vi ~/.transifexrc and put blow code:

     hostname =
     password = your_pass_word
     token = 
     username = your_email_transifex
  6. execute the /var/www/discourse/script/pull_translations.rb :

     ruby pull_translations.rb force
  7. do this :

     # in the container
     sudo -u discourse RAILS_ENV=production bundle exec rake assets:precompile
     # in the server
     ./launcher restart app  

I hope this will work for you.


Thank you for this comprehensive guide.

However, people should know that this process can break some of the translations depending on the version you are running. It is likely the case if you are on stable.

At the time I was not aware that code changes can impact translations typically when a placeholder name is changed (for example from %{n} to %{count}).

Use with caution then. :wink: