[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/l10n/ -> class-wp-translation-controller.php (summary)

I18N: WP_Translation_Controller class.

File Size: 437 lines (12 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 14 functions

  get_instance()
  get_locale()
  set_locale()
  load_file()
  unload_file()
  unload_textdomain()
  is_textdomain_loaded()
  translate()
  translate_plural()
  get_headers()
  normalize_header()
  get_entries()
  locate_translation()
  get_files()

Functions
Functions that are not part of a class:

get_instance()   X-Ref
Utility method to retrieve the main instance of the class.

The instance will be created if it does not exist yet.

return: WP_Translation_Controller

get_locale()   X-Ref
Returns the current locale.

return: string Locale.

set_locale( string $locale )   X-Ref
Sets the current locale.

param: string $locale Locale.

load_file( string $translation_file, string $textdomain = 'default', ?string $locale = null )   X-Ref
Loads a translation file for a given text domain.

return: bool True on success, false otherwise.
param: string $translation_file Translation file.
param: string $textdomain       Optional. Text domain. Default 'default'.
param: string $locale           Optional. Locale. Default current locale.

unload_file( $file, string $textdomain = 'default', ?string $locale = null )   X-Ref
Unloads a translation file for a given text domain.

return: bool True on success, false otherwise.
param: WP_Translation_File|string $file       Translation file instance or file name.
param: string                     $textdomain Optional. Text domain. Default 'default'.
param: string                     $locale     Optional. Locale. Defaults to all locales.

unload_textdomain( string $textdomain = 'default', ?string $locale = null )   X-Ref
Unloads all translation files for a given text domain.

return: bool True on success, false otherwise.
param: string $textdomain Optional. Text domain. Default 'default'.
param: string $locale     Optional. Locale. Defaults to all locales.

is_textdomain_loaded( string $textdomain = 'default', ?string $locale = null )   X-Ref
Determines whether translations are loaded for a given text domain.

return: bool True if there are any loaded translations, false otherwise.
param: string $textdomain Optional. Text domain. Default 'default'.
param: string $locale     Optional. Locale. Default current locale.

translate( string $text, string $context = '', string $textdomain = 'default', ?string $locale = null )   X-Ref
Translates a singular string.

return: string|false Translation on success, false otherwise.
param: string $text       Text to translate.
param: string $context    Optional. Context for the string. Default empty string.
param: string $textdomain Optional. Text domain. Default 'default'.
param: string $locale     Optional. Locale. Default current locale.

translate_plural( array $plurals, int $number, string $context = '', string $textdomain = 'default', ?string $locale = null )   X-Ref
Translates plurals.

Checks both singular+plural combinations as well as just singulars,
in case the translation file does not store the plural.

return: string|false Translation on success, false otherwise.
param: array{0: string, 1: string} $plurals {
param: int                         $number     Number of items.
param: string                      $context    Optional. Context for the string. Default empty string.
param: string                      $textdomain Optional. Text domain. Default 'default'.
param: string                      $locale     Optional. Locale. Default current locale.

get_headers( string $textdomain = 'default' )   X-Ref
Returns all existing headers for a given text domain.

return: array<string, string> Headers.
param: string $textdomain Optional. Text domain. Default 'default'.

normalize_header( string $header )   X-Ref
Normalizes header names to be capitalized.

return: string Normalized header name.
param: string $header Header name.

get_entries( string $textdomain = 'default' )   X-Ref
Returns all entries for a given text domain.

return: array<string, string> Entries.
param: string $textdomain Optional. Text domain. Default 'default'.

locate_translation( string $singular, string $textdomain = 'default', ?string $locale = null )   X-Ref
Locates translation for a given string and text domain.

return: array{source: WP_Translation_File, entries: string[]}|false {
param: string $singular   Singular translation.
param: string $textdomain Optional. Text domain. Default 'default'.
param: string $locale     Optional. Locale. Default current locale.

get_files( string $textdomain = 'default', ?string $locale = null )   X-Ref
Returns all translation files for a given text domain.

return: WP_Translation_File[] List of translation files.
param: string $textdomain Optional. Text domain. Default 'default'.
param: string $locale     Optional. Locale. Default current locale.



Generated : Sun Apr 28 08:20:02 2024 Cross-referenced by PHPXref