Recent

Language_Handler class

Language_Handler

Language handler class.

Handles i18n, WPML integration, and Polylang integration.

Namespace: WebberZone\Knowledge_Base\Frontend
Since: 2.3.0
Source: includes/frontend/class-language-handler.php line 24

Methods

__construct()

Constructor.

Since: 2.3.0
Line: 31

public function __construct(  );

load_plugin_textdomain() static

Initialises text domain for l10n.

Since: 2.3.0
Line: 42

static public function load_plugin_textdomain(  ): void;

Returns: void

get_translated_term_id() static

Translate a term ID to the current language.

Widget and shortcode settings store the term ID saved by the admin in the default language. On a non-default-language page the stored ID must be resolved to the equivalent term in the current language before use.

Since: 3.0.0
Line: 59

static public function get_translated_term_id( int $term_id, string $taxonomy ): int;
TypeNameDescription
int$term_idTerm ID in the default language.
string$taxonomyTaxonomy slug.

Returns: int — Translated term ID, or the original if no translation exists.

get_current_language() static

Return the current language slug, or an empty string when no multilingual plugin is active.

Since: 3.0.0
Line: 85

static public function get_current_language(  ): string;

Returns: string — Language slug (e.g. ‘en’, ‘fr’) or ” if not multilingual.