Skip to content

Running bin/rake gettext:regenerate doesnt work when variable is passed to locale helper

As a result of !68417 (comment 655785219), we found that when using locale helpers such as __, and then running bin/rake gettext:regenerate doesn't pick up changes to variables.

What does this mean?

If we have:

const HELLO = 'Hello'


const locale = { text: __(HELLO) }

Then we change it to:

const HELLO = 'Hello'


const locale = { text: __(HELLO) }

And then re-run bin/rake gettext:regenerate the .po files dont change.

Ways forward

  1. Adjust the rake task
  2. Add a linting rule that doesn't allow to pass variables to locale helpers (__, s__, etc)