translations_api_result
云策文档标注
概述
本文档介绍了 translations_api_result 过滤器,用于过滤 Translation Installation API 的响应结果。它允许开发者在获取翻译数据时修改或扩展返回的数组。
关键要点
- 过滤器名称:translations_api_result
- 参数:$res(成功时为翻译关联数组,失败时为 WP_Error)、$type(请求的翻译类型)、$args(Translation API 参数)
- 返回:应用过滤器后的结果,通常通过 apply_filters 调用
- 相关函数:translations_api(),用于从 WordPress Translation API 检索翻译
- 引入版本:WordPress 4.0.0
代码示例
return apply_filters( 'translations_api_result', $res, $type, $args );
原文内容
Filters the Translation Installation API response results.
Parameters
$resarray|WP_Error- On success an associative array of translations, WP_Error on failure.
translationsarrayList of translations, each an array of data....$0arraylanguagestringLanguage code.versionstringWordPress version.updatedstringDate the translation was last updated, in MySQL datetime format.english_namestringEnglish name of the language.native_namestringNative name of the language.packagestringURL to download the translation package.isostring[]Array of ISO language codes.stringsarrayArray of translated strings used in the installation process.
}
$typestringThe type of translations being requested.$argsobjectTranslation API arguments.Source
return apply_filters( 'translations_api_result', $res, $type, $args );Changelog
Version Description 4.0.0 Introduced.
User Contributed Notes
You must log in before being able to contribute a note or feedback.