brightnucleus/localization
Composer 安装命令:
composer require brightnucleus/localization
包简介
WordPress localization for Bright Nucleus components.
README 文档
README
WordPress localization for Bright Nucleus components.
Table Of Contents
Installation
The best way to use this package is through Composer:
composer require brightnucleus/localization
Basic Usage
This package provides a trait to be used within Bright Nucleus components to load the translation files (compiled *.mo-files) for a given locale.
To use the trait, import it into your class, and call the loadLocalization( $domain, $path ) method.
Example:
<?php namespace Localization\Example; use BrightNucleus\Localization\LocalizationTrait; class TranslatedClass { use LocalizationTrait; public function register() { $this->loadLocalization( 'bn-localization-example', __DIR__ . '/../languages' ); // Your normal registration comes here, knowing that all `gettext` // strings have already been translated. } }
Filters
Each loading of localization files passes through two filters:
-
Localization::LOCALE_FILTER- Filter the locale of a Bright Nucleus library.Arguments:
$locale(string) - The plugin's current locale.$domain(string) - Text domain. Unique identifier for retrieving translated strings.
Return value:
$locale(string) - Filtered locale.
-
Localization::MOFILE_FILTER- Filter the name of the MO-file of a Bright Nucleus library.Arguments:
$path(string) - Path to the MO-file.$locale(string) - The plugin's current locale.$domain(string) - Text domain. Unique identifier for retrieving translated strings.
Return value:
$path(string) - Fitlered path to the MO-file.
Contributing
All feedback / bug reports / pull requests are welcome.
License
Copyright (c) 2016 Alain Schlesser, Bright Nucleus
This code is licensed under the MIT License.
brightnucleus/localization 适用场景与选型建议
brightnucleus/localization 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.44k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 brightnucleus/localization 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 brightnucleus/localization 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-15