Translating your GavernWP-powered WordPress theme

Last Updated:
Gavern Framework

GavernWP fully supports translations. Due to differences resulting from the use of JSON files to generate theme options, a theme’s translation should be done in three places:

  • with files use from a languages catalog;
  • by creating a catalog of a language given in a config catalog; and
  • by creating a catalog of a language given in an options catalog.

The first step is a standard operation described in detail in the WordPress documentation. This article will focus on the two remaining steps.

A typical installation will include an en_US catalog created in the config and options catalogs, which includes JSON configuration files in the English language. To translate a theme into a different language, do the following:

  • Copy this catalog.
  • Change the catalog name to one matching the respective language of your installation (e.g. pl_PL).
  • Change all phrases from the English language to your language.

NOTE! You must not change the names of keys in JSON files as they are required for key values to be read correctly and for the framework to function properly.

Using a code fragment from the widgets.json file as an example:

 "name": "Top widgets",
 "id": "top",
 "description": "Widgets are located under the website header ",
 "before_widget": "<div id=\"%1$s\" class=\"box%2$s\">",
 "after_widget": "</div>",
 "before_title": "<h3 class=\"box-title\">",
 "after_title": "</h3>"

changes should only be made to the following elements:

  • “Top widgets”
  • “Widgets are located under the website header”

By following the above operation, text items will appear in your selected language in the administration panel.

In the event that GavernWP cannot locate a catalog corresponding to the language set in the configuration, files will be loaded by default from the en_US catalog.

Translating your GavernWP-powered WordPress theme 3.005 (60.00%) 2 votes

This article was first published

Villa Belluci - View our NEW theme

Tutorials & tips delivered regularly

Expand your purchase with regular tutorials and tips to making your site better, direct to your email.