Automattic\WooCommerce\Internal\Admin
Translations::build_and_save_translations()
Combine and save translations for a specific locale.
Note that this assumes \WP_Filesystem is already initialized with write access.
Метод класса: Translations{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_and_save_translations( $language_dir, $plugin_domain, $locale );
- $language_dir(строка) (обязательный)
- Path to language files.
- $plugin_domain(строка) (обязательный)
- Text domain.
- $locale(строка) (обязательный)
- Locale being retrieved.
Код Translations::build_and_save_translations() Translations::build and save translations WC 9.2.3
private function build_and_save_translations( $language_dir, $plugin_domain, $locale ) { global $wp_filesystem; $translations_from_chunks = $this->get_translation_chunk_data( $language_dir, $plugin_domain, $locale ); if ( empty( $translations_from_chunks ) ) { return; } $cache_filename = $this->get_combined_translation_filename( $plugin_domain, $locale ); $chunk_translations_json = wp_json_encode( $translations_from_chunks ); // Cache combined translations strings to a file. $wp_filesystem->put_contents( $language_dir . $cache_filename, $chunk_translations_json ); }