Cannot customize some site texts

@sam, thank you for your response. I’ve deployed three Discourse instances using different methods, and all exhibit the same issue, leading me to believe it’s not an installation problem.

Upon re-examining my plugins, I discovered that one of them created a locale file (plugins/XXXX/config/locales/client.en.yml) with the following content:

en:
   js:

Deleting this file resolved the problem. After a brief investigation into the I18n implementation, I found that deep_merge is used to merge translations during loading:

    # File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/simple.rb, line 31
31:         def store_translations(locale, data, options = {})
32:           locale = locale.to_sym
33:           translations[locale] ||= {}
34:           data = data.deep_symbolize_keys
35:           translations[locale].deep_merge!(data)
36:         end

The YAML above is parsed as:

{"en": {"js": null}}

This results in the deletion of the entire content under the en.js key after the merge. As a plugin developer, I understand that this issue stems from my own coding error, and I am fully responsible for it. However, I believe Discourse could benefit from additional checks to warn against such occurrences, especially considering that Discourse already has a design for inspecting locale files, as seen here.

4 Likes