ashrafakl/yii2-locale

yii2-locale 扩展表示与地区相关的数据,例如国家、语言和方向。

安装次数: 382

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

v1.0.3 2017-04-22 11:00 UTC

This package is auto-updated.

Last update: 2024-09-15 03:34:21 UTC


README

Locale 类表示与地区相关的数据,例如国家、语言和方向。

此类使用并依赖于 PHP intl 扩展。

安装

安装此扩展的首选方式是通过 Composer

运行以下命令:

php composer.phar require --prefer-dist ashrafakl/yii2-locale "~1.0.3"

或者添加以下内容到你的 composer.json 文件的 require 部分:

"ashrafakl/yii2-locale": "~1.0.3"

使用方法

扩展安装完成后,将其添加到你的应用程序配置中

<?php
return [
    // ...
    'components' => [
        // ...
        'locale' => [
            'class'=> 'ashrafakl\localization\Locale',
        ],
        // ...
    ]
];

公共属性

公共方法

示例

要获取方向,请使用以下代码:

<?= Yii::$app->locale->getOrientation() ?>