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

Compatible with WPML? #61

Open
megansimpson opened this issue Jun 17, 2019 · 1 comment
Open

Compatible with WPML? #61

megansimpson opened this issue Jun 17, 2019 · 1 comment

Comments

@megansimpson
Copy link

Hi Evan,

I'm excited to start working with this starter. Just getting into Vue.js too, so please bare with me. I've got a client whose site needs to have English and French, and we normally use WPML for that. How would this typically work with this Vue/WP setup? Or would it at all?

Thanks, and let me know if you need more info.
Cheers

@murray-bcoden
Copy link

Hey Evan,

So there are a few approaches you can take with this one. Since you are using WPML I am guessing that in order for you to take advantage of the translations you will be required to add a custom hook that intercepts the API request before it is sent to the front end and translates it there.

Here is a reference to the available hooks in WPML. https://wpml.org/documentation/support/

Another option although is to do the translations in Vue. I found a great article on how to do this:

https://medium.com/hypefactors/add-i18n-and-manage-translations-of-a-vue-js-powered-website-73b4511ca69c

In this case, you would generate the translation file from the content stored in the WPML plugin. The benefit here would be that you would only have to generate that file when translations are added or changed. This provides ample opportunity to cache the translation file on the server or even locally.

In either case there some customization to the template and to WordPress will be required.

Hope that helps.

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

No branches or pull requests

2 participants