CakePHP
  • 文档
    • 手册
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 商业解决方案
  • 周边商品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与进来
    • 问题 (Github)
    • 烘焙坊
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • 领英
    • YouTube
    • Facebook
    • 推特
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • 缓存
    • 集合
    • 命令
    • 控制台
    • 控制器
    • 核心
    • 数据库
    • 数据源
    • 错误
    • 事件
    • 表单
    • Http
    • I18n
    • 日志
    • 邮件
    • 网络
    • ORM
    • 路由
    • 测试套件
    • 实用程序
    • 验证
    • 视图

命名空间 I18n

命名空间

  • Cake\I18n\Exception
  • Cake\I18n\Formatter
  • Cake\I18n\Middleware
  • Cake\I18n\Parser

函数详情

__() ¶

__(string $singular, mixed ...$args): string

如果找到翻译后的字符串,则返回该字符串;否则返回提交的消息。

参数
string $singular

要翻译的文本。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__

__d() ¶

__d(string $domain, string $msg, mixed ...$args): string

允许您覆盖单个消息查找的当前域。

参数
string $domain

域。

string $msg

要翻译的字符串。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__d

__dn() ¶

__dn(string $domain, string $singular, string $plural, int $count, mixed ...$args): string

允许您覆盖单个复数消息查找的当前域。返回来自域 $domain 的 count $count 的 $singular 和 $plural 标识的消息的正确复数形式。

参数
string $domain

域。

string $singular

要翻译的单数字符串。

string $plural

复数。

int $count

计数。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__dn

__dx() ¶

__dx(string $domain, string $context, string $msg, mixed ...$args): string

允许您覆盖单个消息查找的当前域。上下文是翻译字符串的唯一标识符,使其在同一个域内变得唯一。

参数
string $domain

域。

string $context

文本的上下文。

string $msg

要翻译的字符串。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__dx

__dxn() ¶

__dxn(string $domain, string $context, string $singular, string $plural, int $count, mixed ...$args): string

返回由 $singular 和 $plural 为计数 $count 标识的消息的正确复数形式。允许您覆盖单个消息查找的当前域。上下文是翻译字符串的唯一标识符,使其在同一个域内变得唯一。

参数
string $domain

域。

string $context

文本的上下文。

string $singular

要翻译的单数文本。

string $plural

复数文本。

int $count

计数。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__dxn

__n() ¶

__n(string $singular, string $plural, int $count, mixed ...$args): string

返回由 $singular 和 $plural 为计数 $count 标识的消息的正确复数形式。一些语言对于复数消息有多种形式,具体取决于计数。

参数
string $singular

要翻译的单数文本。

string $plural

复数文本。

int $count

计数。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__n

__x() ¶

__x(string $context, string $singular, mixed ...$args): string

如果找到翻译后的字符串,则返回该字符串;否则返回提交的消息。上下文是翻译字符串的唯一标识符,使其在同一个域内变得唯一。

参数
string $context

文本的上下文。

string $singular

要翻译的文本。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__x

__xn() ¶

__xn(string $context, string $singular, string $plural, int $count, mixed ...$args): string

返回由 $singular 和 $plural 为计数 $count 标识的消息的正确复数形式。一些语言对于复数消息有多种形式,具体取决于计数。上下文是翻译字符串的唯一标识符,使其在同一个域内变得唯一。

参数
string $context

文本的上下文。

string $singular

要翻译的单数文本。

string $plural

复数文本。

int $count

计数。

mixed ...$args

包含参数的数组或函数中的多个参数。

返回值
string
链接
https://book.cakephp.com.cn/5/en/core-libraries/global-constants-and-functions.html#__xn

toDate() ¶

toDate(mixed $value, string $format = 'Y-m-d'): Date|null

将值转换为 Date 对象。

integer - 值被视为 Unix 时间戳 float - 值被视为带有微秒的 Unix 时间戳 string - 值被视为 I18N 短格式日期,除非另有说明 其他值返回为 null。

参数
mixed $value

要转换为 Date 的值。

string $format 可选

值的日期格式。默认为短格式(例如:1970-01-01)。

返回值
Date|null

toDateTime() ¶

toDateTime(mixed $value, string $format = DateTimeInterface::ATOM): Cake\I18n\DateTime|null

将值转换为 DateTime 对象。

integer - 值被视为 Unix 时间戳 float - 值被视为带有微秒的 Unix 时间戳 string - 值被视为 Atom 格式的时间戳,除非另有说明 其他值返回为 null。

参数
mixed $value

要转换为 DateTime 的值。

string $format 可选

值的日期时间格式。默认为 Atom 格式(例如:1970-01-01T12:00:00+00:00)。

返回值
Cake\I18n\DateTime|null

接口

  • FormatterInterface

    格式化程序接口

类

  • ChainMessagesLoader

    包装多个消息加载器,按顺序调用它们,直到其中一个返回非空包。

  • Date

    扩展 Chronos 提供的 Date 类。

  • DateTime

    扩展内置的 DateTime 类,以提供方便的方法和区域感知格式化帮助程序。

  • FormatterLocator

    用于加载和保留格式化程序对象的 ServiceLocator 实现。

  • I18n

    I18n 处理文本和时间格式字符串的翻译。

  • MessagesFileLoader

    通用的翻译包工厂,它将根据文件扩展名和包名称加载翻译文件。

  • Number

    数字帮助程序库。

  • Package

    消息目录

  • PackageLocator

    用于加载和保留包对象的 ServiceLocator 实现。

  • PluralRules

    用于根据区域设置确定要用于变量的复数的实用程序类。

  • RelativeTimeFormatter

    用于格式化相对日期和时间的帮助程序类。

  • Time

    扩展 Chronos 提供的 Time 类。

  • Translator

    用于翻译消息的翻译器。

  • TranslatorRegistry

    构造和存储翻译器实例,这些实例可以按名称和区域设置检索。

OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 手册
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与进来
  • 问题 (Github)
  • 烘焙坊
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • 领英
  • YouTube
  • Facebook
  • 推特
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成