Localization

Learn how to add localization, or i18n, by using the Variants Block.

Localization in BaseHub is enabled by the Variant Block.

Create the Variants Block1

Somewhere in the Editor, press “/variants” and add the block. Name it “Language“.

Add some langauges inside2

Add some variants for the languages you’ll support.

Something like this

Enable the set on a Document or a Collection3

Take a look at this short video to see how we do it.

Query by variants on GraphQL4

After committing your changes, you will be able to apply variants arguments on the blocks that you enabled it, check it out:

{
  # from this point on, the schema will inherit the variant selected
  posts(variants: { language: es }) {
    items {
      _title
      excerpt
      coverImage {
        url
      }
      body {
        json {
          content
        }
      }
    }
  }
}
info:

Note that variant sets can only live inside Documents. Because of their unique nature, they cannot be replicated by Components and instances behaviors.

Full Example