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

Slot Content Does Not Update on Language Change with Vue Router #3343

Closed
EugeneBalabai opened this issue Jun 4, 2024 · 6 comments · Fixed by #3348
Closed

Slot Content Does Not Update on Language Change with Vue Router #3343

EugeneBalabai opened this issue Jun 4, 2024 · 6 comments · Fixed by #3348
Assignees

Comments

@EugeneBalabai
Copy link
Contributor

EugeneBalabai commented Jun 4, 2024

Issue Description:
When using Vue with Vue Router and TolgeeJs, the text inside slots of Vue components does not translate when changing the language. This problem is reproduced if you navigate to any page other than the initial one and change the language there.

Steps to Reproduce:

  1. Set up a Vue 3 project with Vue Router and TolgeeJs.
  2. Create a component that uses a slot for content.
  3. Navigate to any page that includes the component with slot content.
  4. Change the language using TolgeeJs.
  5. Observe that the text inside the slots does not update to the new language.

Expected Behavior:
The text inside the slots of Vue components should translate and update to the new language when the language is changed.

Actual Behavior:
The text inside the slots of Vue components remains in the original language and does not update upon changing the language.

Reproduction Link:
Codesandbox Example
Video Example

Additional Context:

Vue version: 3.4.27
Vue Router version: 4.3.2
@tolgee/vue version: 5.28.0
Browser: Chrome
Operating System: macOS

@stepan662
Copy link
Collaborator

Is this some special case with the Vue Router?

@EugeneBalabai
Copy link
Contributor Author

@stepan662 I am not sure it is a special case. I can reproduce it on any page.
I found if I define tolgee in each component

const tolgee = useTolgee(['language'])

and use tolgee.t('key') in templates it works.
So maybe $t in that case lost language updates?

@stepan662 stepan662 self-assigned this Jun 7, 2024
@EugeneBalabai
Copy link
Contributor Author

@stepan662 is there any news?

@stepan662
Copy link
Collaborator

Sorry, I didn't get to it yet.

@stepan662
Copy link
Collaborator

Hey, this solution seems to work well for your case. #3348

@EugeneBalabai
Copy link
Contributor Author

@stepan662 yes, it works. Thank you!

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 a pull request may close this issue.

2 participants