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

Add SSR support and enhance Vue integration for Tolgee #3367

Merged
merged 11 commits into from
Sep 23, 2024

Conversation

EugeneBalabai
Copy link
Contributor

This PR improves the Tolgee integration with Vue, focusing on enhancing Server-Side Rendering (SSR) support and overall functionality. Key changes include:

  • Refactored the TolgeeProvider component to handle SSR scenarios.
  • Improved the useTolgee hook to better handle reactivity and event listeners.
  • Updated the T component to respect the initial render state for SSR.
  • Streamlined the VueTolgee plugin to provide better support for SSR.

These changes aim to provide a more robust integration of Tolgee with Vue applications, especially in SSR environments. The updates should result in improved performance and developer experience when working with translations in Vue projects.

@JanCizmar JanCizmar requested a review from stepan662 September 17, 2024 10:28
packages/vue/src/VueTolgee.ts Show resolved Hide resolved
packages/vue/src/TolgeeProvider.ts Outdated Show resolved Hide resolved
packages/vue/src/VueTolgee.ts Outdated Show resolved Hide resolved
@stepan662
Copy link
Collaborator

Would you be able to also write some short documentation? Something like this https://tolgee.io/js-sdk/integrations/react/ssr . If you don't have time, I can do it, but we need some docs for this.

@EugeneBalabai
Copy link
Contributor Author

I will try to do it this evening. In general, I think we can copy most parts of the React documentation and just adjust the syntax, because for Vue we don't have useTolgeeSSR but the main logic is the same.

@EugeneBalabai
Copy link
Contributor Author

Hey @stepan662,
I've attached a draft of the documentation. I've incorporated most parts from the React SSR documentation. Please feel free to adjust and publish it.

Additionally, I think it would be a good idea to add an example of integration for Nuxt. We should also mention the version of Tolgee that supports Vue SSR.

tolgee-vue-ssr.md

packages/vue/src/T.ts Outdated Show resolved Hide resolved
@stepan662
Copy link
Collaborator

Yeah the example for nuxt would be really cool. I'm currently stuck on a big task in the platform, so I can do it later, if you don't have time to do it.

- Added a check to throw an error if `staticData` or `language` props are not provided during the initial render.
- This ensures that the necessary data is available for proper SSR functionality.
@stepan662 stepan662 merged commit 9c298aa into tolgee:main Sep 23, 2024
26 checks passed
@stepan662
Copy link
Collaborator

@EugeneBalabai Thanks a lot for PR. We'll send you some reward, stay tuned 😉

stepan662 added a commit to tolgee/documentation that referenced this pull request Sep 23, 2024
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.

2 participants