Skip to content

i18n export doesn't export scopes from js files? #699

Answered by JohnRDOrazio
JohnRDOrazio asked this question in Q&A
Discussion options

You must be logged in to vote

Actually I found the fix. Simply i18n-tasks missing or add-missing wasn't picking up on the translation strings because now we have lowercase i18n instead of I18n. The only way I could get it to work was to copy i18n to I18n:

import { i18n } from "../config/i18n"
const I18n = i18n;

Then I use I18n.t('scope.string') instead of i18n.t('scope.string') . And now i18n-tasks missing is picking up the missing strings in the js files.

Another way to possibly fix this would be to patch the i18n-tasks gem to accept a lowercase i18n when scanning, see the related discussion here: glebm/i18n-tasks#453

I also issued a PR on the i18n-js-examples repo to help clear this up: fnando/i18n-js-examples#1

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JohnRDOrazio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant