vuejs-wordpress-theme-starter icon indicating copy to clipboard operation
vuejs-wordpress-theme-starter copied to clipboard

Compatible with WPML?

Open megansimpson opened this issue 5 years ago • 1 comments

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

megansimpson avatar Jun 17 '19 19:06 megansimpson

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.

murray-bcoden avatar Jun 21 '19 08:06 murray-bcoden