bshiluk / vue-wordpress

Use Vue.js and the WP REST API to build WordPress themes as SPAs with dynamic routing, HMR for development, SEO enabled, and SSR capable. Demo:
http://vue-wordpress-demo.bshiluk.com
491 stars 112 forks source link

Integrating multi language support with wpml #7

Open michaelscheurer opened 5 years ago

michaelscheurer commented 5 years ago

Hi @bucky355

I would like to extend the theme with multilanguage support with the help of the wpml plugin (https://wpml.org/)

Do you have any ideas, how to start? Any hints, how to achieve it?

Thanks a lot

Cheers

Michael

matiyin commented 5 years ago

I'm doing a project at the moment with Vue, WPML and WP Rest API.

I use this method to support translation files (json instead of .mo files) and locale switching: https://medium.com/hypefactors/add-i18n-and-manage-translations-of-a-vue-js-powered-website-73b4511ca69c

When you switch language, you can get translations with http://localhost/wp-json/wp/v2/pages?lang=en to get the English data for example and update reactive components with new data.

Maybe it helps someone.