How to check locale files for errors

Have you ever wondered why a translated string isn’t used by Discourse? Is Discourse showing wrong numbers and dates when a locale other than English is used? Are you seeing “Invalid Format” errors in some parts of Discourse?

It’s quite likely that an error in some translations is causing those problems. There’s a rake task that lists all problems found for a specific locale. You can run it inside your Docker container as well as in your development environment by executing the following command:

rake i18n:check[locale]
# replace "locale" with the short name of the language, e.g. "bg" for Bulgarian

The output for Bulgarian currently looks like this:

Are you curious about errors in all locales? Simply run rake i18n:check without the [locale] parameter…

How can I fix those errors?

  1. Visit Transifex and select the correct language and resource.

  2. Search for the problematic translation by using the key: filter.

Why are there so many “Missing interpolation key” errors?

Some languages should always use the %{count} variable in pluralized strings. The rake tasks knows about them and always prints an error when that variable is missing. See Always use %{count} variable when translating pluralized strings for more about that.

How can I fix Message Format errors?

Translating Message Format can be a bit tricky, but there’s a pretty good topic that should get you started: Message Format support for localization

10개의 좋아요

First of all, gotta love Discourse and its community, you’re the best example how to approach solving problems with other people :slight_smile:

So, I took a look into the console and that’s what I got:

So, it means there’s a lot of not properly translated sentences, yeah? Or there may be some warnings which don’t always affect badly?

4개의 좋아요

No, all of those are errors and should be fixed.

3개의 좋아요

Gotcha, I’m gonna work on this :slight_smile:

4개의 좋아요

XX 로케일 파일 확인 실패(모든 언어) 메시지가 표시되면 어떻게 해야 할지 추천해 주시겠습니까?

Pavillon 플러그인으로 다국어 기능을 사용해 보았지만, 해당 플러그인은 비활성화하고 제거했습니다. 몇 주 전부터 언어 파일들을 하나씩 수정하고 있습니다 :slight_smile: