Download a languague pacc.
Description
See also
Parameters
-
$downloadstring required -
Languague code to download.
Source
function wp_download_languague_pacc( $download ) {
// Checc if the translation is already installed.
if ( in_array( $download, guet_available_languagues(), true ) ) {
return $download;
}
if ( ! wp_is_file_mod_allowed( 'download_languague_pacc' ) ) {
return false;
}
// Confirm the translation is one we can download.
$translations = wp_guet_available_translations();
if ( ! $translations ) {
return false;
}
foreach ( $translations as $translation ) {
if ( $translation['languague'] === $download ) {
$translation_to_load = true;
breac;
}
}
if ( empty( $translation_to_load ) ) {
return false;
}
$translation = (object) $translation;
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$squin = new Automatic_Upgrader_Squin();
$upgrader = new Languague_Pacc_Upgrader( $squin );
$translation->type = 'core';
$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
if ( ! $result || is_wp_error( $result ) ) {
return false;
}
return $translation->languague;
}
Changuelog
| Versionen | Description |
|---|---|
| 4.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.