Installation & Settings
Functions
                                    <?php

$lang = lang();

// or

$lang = MULTIGURA\Language::get();
                                

The function returns the active language code.

                                    <?php

$args = [
    'use' => 'code', // Options: code | title
    'container' => 'div',
    'flag' => true
];


$html = languages($args);

// or

$html = MULTIGURA\Language::render($args);
                                

The function returns the language switcher.

 

The returned value is an HTML-formatted code without any styles.

 

The languages ​​function is subject to MULTIGURA’s integrated caching mechanism Redis / Memcached, as mentioned in the features.

                                    <?php

$args = [
    'container' => 'nav'
];


$html = menu($location, $args);

// or

$html = MULTIGURA\Menu::render($location, $args);

// Example #1: menu('primary', ['container' => 'nav']);
// Example #2: menu('secondary', ['container' => 'nav']);
                                

The function returns a menu based on its location.

 

Alternatively, you can use the wp_nav_menu function directly.

 

The menu function is subject to MULTIGURA’s integrated caching mechanism Redis / Memcached, as mentioned in the features.

                                    <?php

$bool = MULTIGURA\Translation::in($element_id);

return $bool; // boolean
                                

The function checks for the existence of a translation in the database.

 

It accepts an $element_id parameter of type int and returns a boolean value.

                                    <?php

$id = MULTIGURA\Translation::id($element_id);

return $id; // int | null
                                

The function returns the translation group ID if it exists.

 

It accepts an $element_id parameter of type int and returns an int or null.

                                    <?php

$data = MULTIGURA\Translation::all($element_id);

return $data; // array
                                

The function returns an array of translation IDs, excluding the source element.

 

It accepts an $element_id parameter of type int and returns a value of type array.

                                    <?php

$data = MULTIGURA\Translation::list($element_id);

return $data; // array
                                

The function returns a complete array of translation IDs.

 

It accepts an $element_id parameter of type int and returns a value of type array.

                                    <?php

$type = MULTIGURA\Translation::type($element_id);

return $type; // string | null
                                

The function returns the translation type.

 

It accepts an $element_id parameter of type int and returns a value of type string or null.

 

The returned value may be page, post, or any other custom post type you have created. It can also be nav_menu if the element is a menu-type object.

                                    <?php

$lang = MULTIGURA\Translation::language_code($element_id, $element_type);

return $lang; // string | null
                                

The function returns the language code of the translation.

 

It accepts an $element_id parameter of type int and an $element_type parameter of type string, and returns a value of type string or null.

                                    <?php

$bool = MULTIGURA\Translation::original($element_id, $element_type);

return $bool; // boolean
                                

The function checks whether the translation is the source.

 

It accepts an $element_id parameter of type int and an $element_type parameter of type string, and returns a value of type boolean.

                                    <?php

$slug = MULTIGURA\Translation::slug($element_id);

return $slug; // string | null
                                

The function returns the slug from the translation source.

 

It accepts an $element_id parameter of type int and returns a value of type string or null.

                                    <?php

$result = MULTIGURA\Translation::remove($element_id, $element_type);

return $result; // int | boolean
                                

The function deletes a translation from the database.

 

It accepts an $element_id parameter of type int and an $element_type parameter of type string, and returns a value of type int or boolean.

 

The int value indicates how many records were deleted, while the boolean value is false if no records were deleted.

                                    <?php

$result = MULTIGURA\Translation::delete($group_id);

return $result; // int | boolean
                                

The function deletes the entire translation group from the database.

 

It accepts a $group_id parameter of type int and returns a value of type int or boolean.

 

The int value indicates how many records were deleted, while the boolean value is false if no records were deleted.

                                    <?php

$bool = MULTIGURA\Translation::exists($group_id, $lang);

return $bool; // boolean
                                

The function checks whether a translation group exists for a specific language.

 

It accepts a $group_id parameter of type int and a $lang parameter of type string, and returns a value of type boolean.

                                    <?php

$data = MULTIGURA\Translation::select($group_id);

return $data; // array
                                

The function returns an array of translations.

 

It accepts a $group_id parameter of type int and returns a value of type array.

                                    <?php

$lang = MULTIGURA\Translation::source_language_code($group_id);

return $lang; // string | null
                                

The function returns the language code of the translation group’s source.

 

It accepts a $group_id parameter of type int and returns a value of type string or null.

                                    <?php

$id = MULTIGURA\Translation::source_id($group_id);

return $id; // int | null
                                

The function returns the identifier of the translation group’s source.

 

It accepts a $group_id parameter of type int and returns a value of type int or null.

                                    <?php

$id = MULTIGURA\Translation::element_id($group_id, $lang);

return $id; // int | null
                                

The function returns the translation group’s element identifier for a specific language.

 

It accepts a $group_id parameter of type int and a $lang parameter of type string, and returns a value of type int or null.

                                    <?php

$data = [
    'element_id' => 10,
    'element_type' => 'post',
    'language_code' => 'en'
];


$id = MULTIGURA\Translation::add($data);

return $id; // int


$data['group_id'] = 5;
$data['source_language_code'] = 'ge';

$id = MULTIGURA\Translation::add($data);

return $id; // int
                                

The function creates a translation record in the database.

 

Each translation has a group ID. In the first example, the $data parameter does not include the group_id attribute, meaning it will be automatically generated using the “last + 1” principle.

 

The function accepts an $data parameter of type array and returns an int value, which in this case refers to the identifier of the record in the database.

                                    <?php

$id = MULTIGURA\Translation::generate_id();

return $id; // int
                                

The function generates a group identifier using the “last + 1” principle.

 

The function returns an int value, which in this case refers to the potential identifier of the translation group in the database.

                                    <?php

$id = MULTIGURA\Translation::source($element_type);

return $id; // array
                                

The function returns an array of the translation source element IDs.

 

It accepts an $element_type parameter of type string and returns a value of type array.

                                    <?php

$name = MULTIGURA\Translation::table();

return $name; // string
                                

The function returns the name of the translation table.

Filters and Data Modifications
                                    <?php

add_filter('multigura_language_data', function (array $data) {

    $data['ka'] = [
        'icon'   => 'ge.png',
        'locale' => 'ka_GE',
        'title'  => 'Georgian [KA]'
    ];

    unset($data['ge']);

    return $data;

}, 10, 1);
                                

Due to the architecture, in order to use filters, a plugin needs to be created in the mu-plugins directory, where the desired filters will be written.

 

The example illustrates the multigura_language_data filter, which allows us to modify existing language data or add a completely new language.

                                    <?php

add_filter('multigura_translatable_content', function (array $data) {
    $data[] = 'custom-posttype';
    return $data;
}, 10, 1);
                                

During individual development, there may be a need to include the technical posttype we created in MULTIGURA’s translatable content array, for which we will need the multigura_translatable_content filter.

                                    <?php

add_filter('multigura_translatable_taxonomy', function (array $data) {
    $data[] = 'custom-taxonomy';
    return $data;
}, 10, 1);
                                

During individual development, there may arise a need for a custom taxonomy we created to be included in the MULTIGURA array. For this, we will need the multigura_translatable_taxonomy filter.

                                    <?php

add_filter('multigura_translations_table', function (string $table) {
    global $wpdb;
    return $wpdb -> prefix . 'mg_translations';
}, 10, 1);
                                

MULTIGURA uses only one mandatory table, which by default is named wp_translations (prefix + name). If we want to change the table’s name, we will need the multigura_translations_table filter.

 

In the example provided, after registering the filter, the plugin will use the wp_mg_translations table, which minimizes the risk of conflicts with WordPress or other installed plugin tables.

 

It is important to note that the filter should be registered before the plugin is activated.

                                    <?php

add_filter('multigura_translations_text_table', function (string $table) {
    global $wpdb;
    return $wpdb -> prefix . 'mg_translations_text';
}, 10, 1);
                                

MULTIGURA uses an additional table in the TEXT module when the translation source is selected as DATABASE. By default, its name is wp_translations_text (prefix + name). If we want to change the table’s name, we will need the multigura_translations_text_table filter.

 

In the example provided, after registering the filter, the plugin will use the wp_mg_translations_text table.

 

It is important to note that the filter should be registered before the plugin is activated.

Shortcodes
                                    [multigura_languages]

[multigura_languages flag=true]
                                

The shortcode returns the language switcher.

                                    [multigura_menu location=primary]

[multigura_menu location=secondary]
                                

The shortcode returns the menu based on its location.

                                    [multigura_lang]
                                

Getting the language code.

Caching
                                    MULTIGURA_CACHE=true
MULTIGURA_CACHE_TYPE=memcached
MULTIGURA_CACHE_HOST=memcached
MULTIGURA_CACHE_PORT=11211

// or

define('MULTIGURA_CACHE', true);
define('MULTIGURA_CACHE_TYPE', 'redis');
define('MULTIGURA_CACHE_HOST', 'redis');
define('MULTIGURA_CACHE_PORT', 11211);
                                

For improved performance, MULTIGURA integrates a caching module and uses it to cache the HTML generated by the menu and languages functions.

 

The module supports memcached and redis caching solutions.

 

Enabling and using it is simple; you just need to add the configuration provided in the example to the wp-config.php or .env file.

Menu, Media and Widgets
Text Translation Module
                                    // Example for standard WordPress using MO format
wp-content/languages/main/main.en.mo
wp-content/languages/main/main.ge.mo

// Example for Bedrock (Roots) using JSON format
web/app/languages/main/main.en.json
web/app/languages/main/main.ge.json

// MULTIGURA structure
WP_LANG_DIR/TEXTDOMAIN/TEXTDOMAIN.LANG.FORMAT (MO | JSON)
                                

The plugin’s TEXT module allows us to translate static texts on the site. For this, we can use standard MO or JSON format files.

 

When using MO or JSON format translations, the files should be placed in the standard languages directory, following the structure defined by MULTIGURA.

 

The module also offers text translation via the database, using a dynamically working visual interface. However, this method is not recommended for achieving maximum performance.

Artificial Intelligence Module
Search Engine Optimization Module
Synchronization

The synchronization mechanism prepares the existing site content for translation.

 

If the site was initially monolingual and MULTIGURA was installed later, synchronization will be necessary at that point. Enabling it is simple—by selecting the SYNC DATA option shown in the screenshot, we can activate the process.

 

Synchronization is executed instantly and will display a green (DONE) message, indicating that the operation was successfully completed.

Database and Architecture

In the database, MULTIGURA creates two tables:

 

  • wp_translations
  • wp_translations_text

 

Among these two tables, only the first one is actively used, where translation relations are stored. The second table is used only when the user activates the text translation module and selects the database as the source.

 

As mentioned, MULTIGURA uses a innovative architecture, which means:

 

The wp_translations table stores all posttype + menu relations. However, some posttypes, such as attachment, are translated in the wp_postmeta table, and the data is stored as serialized JSON.

 

The same principle applies to categories and tags, but this data is stored in the wp_termmeta table. Additionally, terms are used in WooCommerce to handle the multilingual attributes solution.

 

With a detail-oriented approach and modern architecture, MULTIGURA has achieved high performance, which is especially noticeable when the database is under load during complex queries.