WP_Translation_File::transform
Creates a new WP_Translation_File instance for a given file.
Метод класса: WP_Translation_File{}
Хуков нет.
Возвращает
Строку|false. Transformed translation file contents on success, false otherwise.
Использование
$result = WP_Translation_File::transform( $file, $filetype );
- $file(строка) (обязательный)
- Source file name.
- $filetype(строка) (обязательный)
- Desired target file type.
Список изменений
| С версии 6.5.0 | Введена. |
Код WP_Translation_File::transform() WP Translation File::transform WP 7.0.4
public static function transform( string $file, string $filetype ) {
$source = self::create( $file );
if ( false === $source ) {
return false;
}
switch ( $filetype ) {
case 'mo':
$destination = new WP_Translation_File_MO( '' );
break;
case 'php':
$destination = new WP_Translation_File_PHP( '' );
break;
default:
return false;
}
$success = $destination->import( $source );
if ( ! $success ) {
return false;
}
return $destination->export();
}