当前位置: 首页>>代码示例>>PHP>>正文


PHP CBTxt::hasText方法代码示例

本文整理汇总了PHP中CBLib\Language\CBTxt::hasText方法的典型用法代码示例。如果您正苦于以下问题:PHP CBTxt::hasText方法的具体用法?PHP CBTxt::hasText怎么用?PHP CBTxt::hasText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBLib\Language\CBTxt的用法示例。


在下文中一共展示了CBTxt::hasText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: T

 /**
  * T like Translate text from english to target language
  * (can add translation markers in TEXT for display in language debug mode)
  *
  * Multiple keys can be given if string starts with *, and will be tried from left to right until English string at right, E.g. as follows:
  * T( '*REGISTRATION_SIGN-UP_TITLE*REGISTRATION_SIGN-UP*Sign-up' );
  * This allows to translate or override specific texts, or generally.
  *
  * Variables substitution is performed for the $args parameter.
  *
  * The message supports two different types of pluralization rules:
  *
  * interval: {0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples
  * indexed:  There is one apple|There are %count% apples
  *
  * The indexed solution can also contain labels (e.g. one: There is one apple).
  * This is purely for making the translations more clear - it does not
  * affect the functionality.
  *
  * The two methods can also be mixed:
  *     {0} There are no apples|one: There is one apple|more: There are %count% apples
  *
  * @param  string  $languageKeys   Key(s) separated by space. Or if second argument is empty, English string
  *                                 (e.g. 'KEY1-DETAILED KEY2-GENERAL')
  * @param  string  $englishString  The English string to use if no translations found
  * @param  array   $args           A strtr-formatted array of string substitutions
  * @return string                  Translated string
  *
  * @throws \InvalidArgumentException
  */
 public static function T($languageKeys, $englishString = null, array $args = array())
 {
     if ($languageKeys == '') {
         return $languageKeys;
     }
     $translated = static::$self->translateToCurrentLanguage($languageKeys, $englishString, $args);
     if (static::$self->mode == 0) {
         return $translated;
     }
     if (!static::$self->hasText($languageKeys)) {
         return $languageKeys;
     }
     $isTranslated = !is_null(static::$self->lastKeyUsed);
     static::$self->translationsLogger->recordUsedString($languageKeys, static::$self->lastKeyUsed, static::$self->lastAutoKey, $englishString, $isTranslated ? $translated : null);
     if (!$isTranslated) {
         return '===\\' . $translated . '/---';
     }
     return '*' . $translated . '*';
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:49,代码来源:CBTxt.php


注:本文中的CBLib\Language\CBTxt::hasText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。