Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update i18n example test to actually exercise vuei18n #673

Closed

Conversation

sarayourfriend
Copy link

This shows a minimal reproduction of the issue discussed in #585

Hi from @nuxtjs/i18n: {{ (('hello')) }}
Hi from @nuxtjs/i18n: {{ $t('hello') }}
</div>
<div>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div>
<i18n-t scope="global" keypath="message"><template #module>@nuxtjs/i18n</template></i18n-t>
<div>

The error in i18n can be fixed by importing i18n from useNuxtApp().$i18n. However, I couldn't find a way to fix the i18n-t component. I tried replacing it with the Translation component imported from vue-i18n, but the error persists.

This suggested change will also need an addition to the i18n messages:
"message": "Hello from {module}"

@danielroe danielroe mentioned this pull request Dec 25, 2023
8 tasks
@danielroe
Copy link
Member

As far as I can tell the issue here is because the @nuxtjs/i18n module is calling vueApp.use on the CJS version of vue-i18n, but when we use useI18n in the test, it's the ESM version of the library, and so it thinks it's not registered.

Without looking further (though of course I will) I'm not sure whether this is something that @nuxt/test-utils should solve or whether it's an upstream issue ....

cc: @BobbieGoede so you're aware

@sarayourfriend
Copy link
Author

Thanks for figuring that out! Indeed, that doesn't seem like something this library should fix. @obulat I wonder if we can force Openverse (or at least the test suite) to use the CJS version?

@obulat
Copy link

obulat commented Dec 26, 2023

I opened an issue with the reproductions (using composable and i18n-t component) in the @nuxt-modules/i18n repository.
@sarayourfriend, I tried to find a way to hot-fix this issue, but I couldn't.
@danielroe, thank you for investigating this issue. Do you have any suggestions for hot-fixing this until the solution is found?

@danielroe
Copy link
Member

I still plan to investigate this further.

@indiehjaerta
Copy link

Any updates on the investigation of this? As it stands now this problem stops us from upgrading to the @nuxt/test-utils from nuxt-vitest that we have used before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants