Multilanguage with ACF

Dear frontity community. We are developing the multilanguage website by using Frontity.
We have a dev build here: http://time.webbuilder.in.ua/
We don’t use any plugins like polylang for multilanguage because in our practice it works with bugs. We use ACF instead of it.
The example of data: https://time-admin.webbuilder.in.ua/wp-json/wp/v2/posts?slug=v-harkove-uzhestochili-karantin
As you see, in ACF we have a language identifier with the data.

We found the way to change the language in the state immediately and it works well.
Also, we can use GET parameter lang to identify the default language.
The example url:

Problem:
We need to set

  • /our-link for the base laguage
  • /uk/our-link for the another language.
    The API request for the 2 urls should be the same.
    How we can do it in Frontity ?

The project repo: https://github.com/dancer2090/time-frontity

Hey @ivaneichyk.ivan, why not using two different sites, one for each language, combined with the state.source.subdirectory option?

Something like this:

const settings = [
  {
    name: "frontity",
    state: {
      frontity: {
        url: "http://time.webbuilder.in.ua",
        title: "Frontity",
      },
    },
    packages: [
      {
        name: "@frontity/mars-theme",
        state: {
          theme: {
            menu: [
              ["Home", "/"],
              ["Nature", "/category/nature/"],
              ["About Us", "/about-us/"],
              ["UK", "http://time.webbuilder.in.ua/uk"],
            ],
          },
        },
      },
      {
        name: "@frontity/wp-source",
        state: {
          source: {
            api: "https://test.frontity.org/wp-json",
          },
        },
      },
      "@frontity/tiny-router",
      "@frontity/html2react",
    ],
  },
  {
    name: "frontity-uk",
    match: ["https?:\\/\\/[^/]+\\/uk([^-\\w]|$)"],
    state: {
      frontity: {
        url: "http://time.webbuilder.in.ua/uk",
        title: "Frontity UK",
      },
    },
    packages: [
      {
        name: "@frontity/mars-theme",
        state: {
          theme: {
            menu: [
              ["Home", "/uk"],
              ["Nature", "/uk/category/nature/"],
              ["About Us", "/uk/about-us/"],
              ["Non-UK", "http://time.webbuilder.in.ua"],
            ],
          },
        },
      },
      {
        name: "@frontity/wp-source",
        state: {
          source: {
            api: "https://test.frontity.org/wp-json",
            subdirectory: "uk",
          },
        },
      },
      "@frontity/tiny-router",
      "@frontity/html2react",
    ],
  },
];

export default settings;

I’ve created a CodeSandbox with the example:

Let me know if it works :slightly_smiling_face: