Skip to content

Commit

Permalink
Fix extraction of locale from translation files
Browse files Browse the repository at this point in the history
The `LocaleExtractor` recognizes these kind of files:

  - `<locale>.yaml`
  - `<locale>_something.yaml`

It does not recognize these files we use:

  - `js-<locale>.yaml` (locale is extracted as `js-<locale>`)
  - `<locale>.seeders.yaml` (locale is extracted as `<locale>.seeders`)

It's fixed by deleting the `js-` prefix and the `.seeders` suffix from
the extracted locale.
  • Loading branch information
cbliard committed Oct 14, 2024
1 parent 9ffe495 commit cbf338b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/support/i18n_lazy_loading.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def self.locale_from_path(path)

return if locale.nil?

locale.tr("js-", "").to_sym
locale.delete_prefix("js-").delete_suffix(".seeders").to_sym
end
end

Expand Down

0 comments on commit cbf338b

Please sign in to comment.