WPSEO_Metabox_Formatter::get_translations()
Returns Jed compatible YoastSEO.js translations.
Метод класса: WPSEO_Metabox_Formatter{}
Хуков нет.
Возвращает
Массив
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_translations();
Код WPSEO_Metabox_Formatter::get_translations() WPSEO Metabox Formatter::get translations Yoast 21.5
private function get_translations() { $locale = \get_user_locale(); $file = WPSEO_PATH . 'languages/wordpress-seo-' . $locale . '.json'; if ( file_exists( $file ) ) { // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file. $file = file_get_contents( $file ); if ( is_string( $file ) && $file !== '' ) { return json_decode( $file, true ); } } return []; }