Hi guys,
I’m experiencing some difficulties in implementing a multilanguage website. I DON’T want to create a multisite, just handle two languages. I tried with Polylang and WPML without success.
I’ve been looking for websites with effective multilanguage support to better understand but seems no website created with frontity has more than one language.
My main problem is about reaching both languages. Setting 2 different website URLs with regex for matching the “/en” or in my case the it version (without using “/it” in the URL being the default option), just return me 404 on calling the /en version.
Here’s my frontity.settings.js:
const settings = [
{
name: "test ita",
match: ["^.*(?:localhost:3000)((?!(/en))).*$"],
state: {
frontity: {
url: "localhost:3000",
title: "Test",
description: "WordPress installation for Frontity development",
},
theme: {
lang: "it",
},
},
packages: [
{
name: "my-theme",
state: {
theme: {
menu: [],
featured: {
showOnList: false,
showOnPost: false,
},
},
},
},
{
name: "@frontity/wp-source",
state: {
source: {
api: "http://localhost/wp-json",
homepage: "/hp",
},
},
},
"@frontity/tiny-router",
"@frontity/html2react",
],
},
{
name: "test eng",
match: ["localhost:3000/en(/.*)?$"],
state: {
frontity: {
url: "localhost:3000",
title: "Test",
description: "WordPress installation for Frontity development",
},
theme: {
lang: "en",
},
},
packages: [
{
name: "my-theme",
state: {
theme: {
menu: [],
featured: {
showOnList: false,
showOnPost: false,
},
},
},
},
{
name: "@frontity/wp-source",
state: {
source: {
api: "http://localhost/wp-json",
homepage: "/hp",
},
},
},
"@frontity/tiny-router",
"@frontity/html2react",
],
},
];
export default settings;
I noticed that with both plugins, sharing the same slug returns me 404 when calling both language homepages. I also don’t understand if i have to set “hp” or “/en/hp” for the english version.