wp_set_lang_dir()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_set_lang_dir()
Описание
Чтобы задать каталог вручную, определите константу WP_LANG_DIR в wp-config.php.
Если каталог языков существует внутри WP_CONTENT_DIR, используется он. Иначе предполагается, что каталог языков находится в WPINC.
Оригинал (английский)
To set directory manually, define the WP_LANG_DIR constant in wp-config.php.
If the language directory exists within WP_CONTENT_DIR, it is used. Otherwise the language directory is assumed to live in WPINC.
Исходный код
wp-includes/load.php:663
function wp_set_lang_dir() {
if ( ! defined( 'WP_LANG_DIR' ) ) {
if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' )
|| ! @is_dir( ABSPATH . WPINC . '/languages' )
) {
/**
* Server path of the language directory.
*
* No leading slash, no trailing slash, full path, not relative to ABSPATH
*
* @since 2.1.0
*/
define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
if ( ! defined( 'LANGDIR' ) ) {
// Old static relative path maintained for limited backward compatibility - won't work in some cases.
define( 'LANGDIR', 'wp-content/languages' );
}
} else {
/**
* Server path of the language directory.
*
* No leading slash, no trailing slash, full path, not relative to `ABSPATH`.
*
* @since 2.1.0
*/
define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
if ( ! defined( 'LANGDIR' ) ) {
// Old relative path maintained for backward compatibility.
define( 'LANGDIR', WPINC . '/languages' );
}
}
}
}
История изменений
| Версия | Описание |
|---|---|
| 3.0.0 | Introduced. |

