Language Variables in Themes

Implementing Language Variables and Translations in Venddor IO

Venddor IO provides the functionality to incorporate language variables and translations directly through themes. To ensure consistency, it's imperative to place translation files in the langs subfolder within the specific theme's main directory. Adhering to naming conventions, these files should follow the pattern: [language_code].po. For instance, the English translation file would be aptly named en.po.

Within the theme's structure, the PO file occupies a pivotal position. When installing a theme, its associated language variables seamlessly integrate into the database.

Furthermore, Venddor IO permits the stipulation of a theme's primary language. This facilitates default translations, bridging the gap for languages that the theme may not inherently support. To achieve this, the default_language field in the theme's manifest.json can be leveraged:

"default_language": "en"

In situations where the default_language is absent, the system follows a two-step protocol:

  1. Should the langs directory embody a PO file corresponding to the store's default language, it is designated as the default language.
  2. Conversely, if the langs directory lacks a PO file matching the store's default language, the directory's inaugural PO file becomes the default translation source.

It's crucial to note that the cornerstone for discerning the store's principal language lies in the "Backend default language" option within Settings → Appearance in Venddor IO.

In essence, Venddor IO's adaptive approach ensures themes are equipped with comprehensive language support, enhancing the user experience and ensuring compatibility across diverse linguistic audiences.