Invalid Format: Uncaught SyntaxError due to translations

AI-generated summary

The discussion revolves around resolving a syntax error caused by translations in a Discourse forum. calebs shared the error message “Invalid Format: Uncaught SyntaxError: Expected ‘=’, ‘}’ or [a-zA-Z$_] but ‘%u043F’ found” and suspected it was related to their manual Bulgarian translation. gerhard provided a link to a solution on Meta Discourse, which involves checking locale files for errors using the command rake i18n:check[bg]. The command revealed several missing and unsupported interpolation keys, as well as an invalid message format in the js.topic.read_more_MF translation. gerhard suggested fixing the translation on Transifex to benefit everyone. Dmitry_Krasnoperov added that a similar error occurs with the Russian translation enabled.

Hi again! Our forum is finally working smoothly, thanks to the support I’ve received here.

However, i’ve just noticed the following error at the bottom of the pages of the forum:

Invalid Format: Uncaught SyntaxError: Expected “=”, “}” or [a-zA-Z$_] but “%u043F” found. at undefined:1376:10

I guess it’s an issue with my translations, since I’m manually doing it for the entire system.

Could anyone tell me where to fix that? I’m using a 50% finished bulgarian translation and doing the rest on my own, if that’s even the case.

Thanks!

How to check locale files for errors has all the answers.

$ rake i18n:check[bg]

================================================================================
config/locales/client.bg.yml
================================================================================
js.about.contact_info -- Missing interpolation keys: ["contact_info"]
js.about.contact_info -- Unsupported interpolation keys: ["contact_email"]
admin_js.admin.backups.operations.failed -- Missing interpolation keys: ["operation"]
js.topic.read_more_MF -- Invalid message format: Uncaught SyntaxError: Expected "=", "}" or [a-zA-Z$_] but "%u043F" found.

================================================================================
config/locales/server.bg.yml
================================================================================
education.new-topic -- Missing interpolation keys: ["base_path"]
dashboard.rails_env_warning -- Missing interpolation keys: ["env"]
user_notifications.posted_by -- Missing interpolation keys: ["username"]

You should take a closer look at the translation for js.topic.read_more_MF and fix it on Transifex, so that everyone profits from your work.

5 Likes

One more error. Russian translation enabled.

Invalid Format: Uncaught SyntaxError: Expected "=", "}" or [a-zA-Z$_] but "%u0438" found. at undefined:1376:10