Hello,
We do a lot of multilanguage sites and use wpml because it’s a easy setup to go, (so we would really like to stick with that workflow), but reading here a lot of posts, it seems not a common way:
you have your url and for each language there is query var which is rewriten as first pathsegment, this is also reflected in the wordpress api, if you connect wpml to it, this results in sth like this:
domain.com/en as english homepage and for example domain.com/de for german with two api’s which will hold all endpoints
domain.com/en/wp-json/ and domain.com/de/wp-json/ where translated items refer to each other, which lead me to following code to begin with, but before I move on - is this a solution i can use, or am I thinking complete wrong? It’s my first project using frontity, would be very helpful to have some feedback.
thanks for your time
const settings = [
{
name: "frontitytest-de",
state: {
frontity: {
url: "https://domain.com/de",
title: "Test Frontity",
description: "WordPress installation for Frontity development"
},
},
packages: [
{
"name": "@frontity/twentytwenty-theme",
"state": {
"theme": {
"menu": [
[
"Home",
"/de/"
],
[
"En",
"/en/"
]
],
"featured": {
"showOnList": false,
"showOnPost": false
}
}
}
},
{
"name": "@frontity/wp-source",
state: {
source: {
"api": "https://domain.com/de/wp-json",
params: {
lang: "de",
},
subdirectory: "de",
},
},
},
"@frontity/tiny-router",
"@frontity/html2react",
],
},
{
name: "frontity-en",
match: ["https?:\\/\\/[^/]+\\/en([^-\\w]|$)"],
state: {
frontity: {
url: "https://domain.com/en",
title: "Test en"
},
},
packages: [
{
"name": "@frontity/twentytwenty-theme",
"state": {
"theme": {
"menu": [
[
"Home",
"/en/"
],
[
"de",
"/de/"
]
],
"featured": {
"showOnList": true,
"showOnPost": false
}
}
}
},
{
"name": "@frontity/wp-source",
state: {
source: {
"api": "https://domain.com/en/wp-json",
params: {
lang: "en",
},
subdirectory: "en",
},
},
},
"@frontity/tiny-router",
"@frontity/html2react",
],
},
]
export default settings;