[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-textdomain-registry.php (summary)

Locale API: WP_Textdomain_Registry class. This file uses rtrim() instead of untrailingslashit() and trailingslashit() to avoid formatting.php dependency.

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

Defines 1 class

WP_Textdomain_Registry:: (9 methods):
  init()
  get()
  has()
  set()
  set_custom_path()
  get_language_files_from_path()
  invalidate_mo_files_cache()
  get_paths_for_domain()
  get_path_from_lang_dir()


Class: WP_Textdomain_Registry  - X-Ref

Core class used for registering text domains.

init()   X-Ref
Initializes the registry.

Hooks into the {@see 'upgrader_process_complete'} filter
to invalidate MO files caches.


get( $domain, $locale )   X-Ref
Returns the languages directory path for a specific domain and locale.

return: string|false Languages directory path or false if there is none available.
param: string $domain Text domain.
param: string $locale Locale.

has( $domain )   X-Ref
Determines whether any MO file paths are available for the domain.

This is the case if a path has been set for the current locale,
or if there is no information stored yet, in which case
{@see _load_textdomain_just_in_time()} will fetch the information first.

return: bool Whether any MO file paths are available for the domain.
param: string $domain Text domain.

set( $domain, $locale, $path )   X-Ref
Sets the language directory path for a specific domain and locale.

Also sets the 'current' property for direct access
to the path for the current (most recent) locale.

param: string       $domain Text domain.
param: string       $locale Locale.
param: string|false $path   Language directory path or false if there is none available.

set_custom_path( $domain, $path )   X-Ref
Sets the custom path to the plugin's/theme's languages directory.

Used by {@see load_plugin_textdomain()} and {@see load_theme_textdomain()}.

param: string $domain Text domain.
param: string $path   Language directory path.

get_language_files_from_path( $path )   X-Ref
Retrieves translation files from the specified path.

Allows early retrieval through the {@see 'pre_get_mo_files_from_path'} filter to optimize
performance, especially in directories with many files.

return: array Array of translation file paths. Can contain .mo and .l10n.php files.
param: string $path The directory path to search for translation files.

invalidate_mo_files_cache( $upgrader, $hook_extra )   X-Ref
Invalidate the cache for .mo files.

This function deletes the cache entries related to .mo files when triggered
by specific actions, such as the completion of an upgrade process.

param: WP_Upgrader $upgrader   Unused. WP_Upgrader instance. In other contexts this might be a
param: array       $hook_extra {

get_paths_for_domain( $domain )   X-Ref
Returns possible language directory paths for a given text domain.

return: string[] Array of language directory paths.
param: string $domain Text domain.

get_path_from_lang_dir( $domain, $locale )   X-Ref
Gets the path to the language directory for the current domain and locale.

Checks the plugins and themes language directories as well as any
custom directory set via {@see load_plugin_textdomain()} or {@see load_theme_textdomain()}.

return: string|false Language directory path or false if there is none available.
param: string $domain Text domain.
param: string $locale Locale.



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref