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

fix: v-t directive SSR #2946

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BobbieGoede
Copy link
Collaborator

@BobbieGoede BobbieGoede commented May 10, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves kazupon/kazupon#17

I thought adding the directive transformation would have been more involved than this but it seems to be working πŸ˜…

I'll see if I can update https://github.com/intlify/vue-i18n-extensions a bit and perhaps experiment with making something like intlify/vue-i18n#1820 possible, though to be honest, I'm not sure if that feature is the right direction but it would be good learning experience.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede self-assigned this May 10, 2024
@BobbieGoede BobbieGoede requested a review from kazupon May 10, 2024 13:12
@BobbieGoede BobbieGoede marked this pull request as ready for review May 10, 2024 13:12
*/

// Use `legacy` as global injections are prefixed (`$t`)
const transformVT = transformVTDirective({ mode: 'legacy' })
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think mode option should be set from i18n.types

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I'm misunderstanding, but the injected component properties are always prefixed with $ (such as $t()) right?

When passing mode: 'composition' to the transform it will (in this case incorrectly) transform the code to use t() without prefix, which I think won't work πŸ€”.

Copy link
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Thank you so much!
I've just comment to your PR!
Please check it!

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.

hello! kazupon!
2 participants