本文整理汇总了PHP中ResourceLoaderModule::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceLoaderModule::getMessages方法的具体用法?PHP ResourceLoaderModule::getMessages怎么用?PHP ResourceLoaderModule::getMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceLoaderModule
的用法示例。
在下文中一共展示了ResourceLoaderModule::getMessages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateMessageBlob
/**
* Generate the message blob for a given module in a given language.
*
* @param ResourceLoaderModule $module
* @param string $lang Language code
* @return string JSON blob
*/
private function generateMessageBlob(ResourceLoaderModule $module, $lang)
{
$messages = [];
foreach ($module->getMessages() as $key) {
$messages[$key] = $this->fetchMessage($key, $lang);
}
$json = FormatJson::encode((object) $messages);
if ($json === false) {
$this->logger->warning('Failed to encode message blob for {module} ({lang})', ['module' => $module->getName(), 'lang' => $lang]);
$json = '{}';
}
return $json;
}
示例2: generateMessageBlob
/**
* Generate the message blob for a given module in a given language.
*
* @param $module ResourceLoaderModule object
* @param $lang String: language code
* @return String: JSON object
*/
private static function generateMessageBlob(ResourceLoaderModule $module, $lang)
{
$messages = array();
foreach ($module->getMessages() as $key) {
$messages[$key] = wfMsgExt($key, array('language' => $lang));
}
return FormatJson::encode((object) $messages);
}
示例3: generateMessageBlob
/**
* Generate the message blob for a given module in a given language.
*
* @param ResourceLoaderModule $module
* @param string $lang Language code
* @return string JSON object
*/
private function generateMessageBlob(ResourceLoaderModule $module, $lang)
{
$messages = array();
foreach ($module->getMessages() as $key) {
$messages[$key] = wfMessage($key)->inLanguage($lang)->plain();
}
return FormatJson::encode((object) $messages);
}
示例4: generateMessageBlob
/**
* Generate the message blob for a given module in a given language.
*
* @param ResourceLoaderModule $module
* @param string $lang Language code
* @return string JSON blob
*/
private function generateMessageBlob(ResourceLoaderModule $module, $lang)
{
$messages = array();
foreach ($module->getMessages() as $key) {
$messages[$key] = $this->fetchMessage($key, $lang);
}
return FormatJson::encode((object) $messages);
}