JPKCom Simple Lang

frontend-language.php

Frontend Language Override

Handles switching the locale in the frontend based on post language settings.

Tags
since
1.0.0

Table of Contents

Functions

jpkcom_simplelang_get_language_code()  : string
Convert locale to language code
jpkcom_simplelang_get_current_language()  : string|null
Get current frontend language

Functions

jpkcom_simplelang_get_language_code()

Convert locale to language code

jpkcom_simplelang_get_language_code(string $locale) : string

Converts a locale string (e.g., de_DE) to a language code (e.g., de).

Parameters
$locale : string

The locale string.

Tags
since
1.0.0
Return values
string

The language code.

jpkcom_simplelang_get_current_language()

Get current frontend language

jpkcom_simplelang_get_current_language() : string|null

Returns the currently active language for the frontend.

Tags
since
1.0.0
Return values
string|null

The current language locale or null if using site default.


        
On this page

Search results