Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:public:functions-i18n

This is an old revision of the document!


public/themes/blog/functions-i18n.php

Source: public/themes/blog/functions-i18n.php · 339 lines, ~1675 statements · namespace: (global) · `declare(strict_types=1)`: no


Blog Theme i18n Helpers

Internationalization and locale helpers for the Bootstrap Blog theme. Extracted from the monolithic functions.php (Phase 5 remediation). All functions use function_exists() guards to avoid redeclaration errors.

Functions (14)

^ Function ^ Line ^ Params ^ Returns ^ Summary ^
| ''t'' | 20 | 2 | ''string'' | t() - Translation function for frontend |
| ''detect_browser_locale'' | 49 | 0 | ''string'' | detect_browser_locale() - Detect browser locale |
| ''load_theme_translations'' | 81 | 1 | ''array'' | load_theme_translations() - Load translations from JSON file |
| ''reset_i18n_cache'' | 107 | 0 | ''void'' | reset_i18n_cache() - Reset translation cache |
| ''locale_url'' | 117 | 2 | ''string'' | locale_url() - Get URL with locale prefix |
| ''is_locale_prefix_enabled'' | 154 | 0 | ''bool'' | is_locale_prefix_enabled() - Check if locale prefix should be added |
| ''get_default_locale'' | 174 | 0 | ''string'' | get_default_locale() - Get the default locale |
| ''get_locale'' | 189 | 0 | ''string'' | get_locale() - Get current locale |
| ''available_locales'' | 204 | 0 | ''array'' | available_locales() - Get available locales |
| ''is_rtl'' | 219 | 0 | ''bool'' | is_rtl() - Check if current locale is RTL |
| ''get_html_dir'' | 234 | 0 | ''string'' | get_html_dir() - Get HTML dir attribute |
| ''get_language_name'' | 244 | 2 | ''string'' | get_language_name() - Get human-readable language name |
| ''get_all_language_names'' | 265 | 0 | ''array'' | get_all_language_names() - Get all available language names |
| ''language_switcher'' | 286 | 1 | ''string'' | language_switcher() - Generate language switcher HTML |

t()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function t(string $key, array $params = []): string

t() - Translation function for frontend

^ Parameter ^ Type ^ Default ^ Description ^
| ''$key'' | ''string'' | //required// |  |
| ''$params'' | ''array'' | ''[]'' |  |

detect_browser_locale()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function detect_browser_locale(): string

detect_browser_locale() - Detect browser locale

load_theme_translations()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function load_theme_translations(string $locale): array

load_theme_translations() - Load translations from JSON file

^ Parameter ^ Type ^ Default ^ Description ^
| ''$locale'' | ''string'' | //required// |  |

reset_i18n_cache()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function reset_i18n_cache(): void

reset_i18n_cache() - Reset translation cache

locale_url()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function locale_url(string $path = '', ?string $locale = null): string

locale_url() - Get URL with locale prefix

^ Parameter ^ Type ^ Default ^ Description ^
| ''$path'' | ''string'' | '''''' |  |
| ''$locale'' | ''?string'' | ''null'' |  |

is_locale_prefix_enabled()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function is_locale_prefix_enabled(): bool

is_locale_prefix_enabled() - Check if locale prefix should be added

get_default_locale()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function get_default_locale(): string

get_default_locale() - Get the default locale

get_locale()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function get_locale(): string

get_locale() - Get current locale

available_locales()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function available_locales(): array

available_locales() - Get available locales

is_rtl()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function is_rtl(): bool

is_rtl() - Check if current locale is RTL

get_html_dir()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function get_html_dir(): string

get_html_dir() - Get HTML dir attribute

get_language_name()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function get_language_name(string $locale, bool $native = true): string

get_language_name() - Get human-readable language name

^ Parameter ^ Type ^ Default ^ Description ^
| ''$locale'' | ''string'' | //required// |  |
| ''$native'' | ''bool'' | ''true'' |  |

get_all_language_names()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function get_all_language_names(): array

get_all_language_names() - Get all available language names

language_switcher()

Declared inside a guard (the project uses `if (!function_exists(…))` around global functions), so the declaration is conditional at load time.

public function language_switcher(array $args = []): string

language_switcher() - Generate language switcher HTML

^ Parameter ^ Type ^ Default ^ Description ^
| ''$args'' | ''array'' | ''[]'' |  |

Generated by 'tools/gendoc'.

scriptlog/public/functions-i18n.1790413764.txt.gz · Last modified: by admin