68publishers/i18n
Composer 安装命令:
composer require 68publishers/i18n
包简介
Internationalization and localization your app with a minimum effort.
README 文档
README
⚠️ Warning! This package does not have active support, it exists only for the historical needs of the author.
i18n
This package helps you to deal with regions with different languages, currencies and countries. It could be helpful even if you have single region project.
Installation
The best way to install 68publishers/i18n is using Composer:
$ composer require 68publishers/i18n
then you can register extension into DIC:
extensions: 68publishers.i18n: SixtyEightPublishers\i18n\DI\I18nExtension(%debugMode%)
Configuration
68publishers.i18n: profiles: europe: language: [ sk_SK, en_GB, de_DE, pl_PL ] currency: [ EUR, PLZ, GBP ] country: [ SK, GB, DE, PL ] domain: [ 'europe\.example\.com' ] # regex north_america: language: en_US currency: USD country: US domain: 'example\.com\/na' enabled: no # default is `yes` default: # If the default profile doesn't exists, the first profile is taken as default language: cs_CZ currency: CZK country: CZ lists: fallback_language: en # default default_language: null # default translation_bridge: locale_resolver: enabled: yes # registers custom TranslatorLocaleResolver through 68publishers/translation-bridge extension use_default: yes # use language of default's profile if profile is not detected, default is `no` priority: 15 # if you want to use custom profile storage or profile detector: storage: My\Custom\ProfileStorage detector: My\Custom\Detector
Integration with 68publishers/translation-bridge
Translator Locale Resolving
The Translator's locale can be resolved by the currently active profile.
That is done with custom TranslatorLocaleResolver that is automatically registered if an option translation_bridge.locale_resolver.enabled is set to TRUE.
Synchronization Between Profile's Language and Translator's Locale
The Translator's locale is automatically changed when the active profile's language is changed.
<?php /** @var \SixtyEightPublishers\i18n\Profile\ActiveProfile $activeProfile */ /** @var \SixtyEightPublishers\TranslationBridge\Localization\TranslatorLocalizerInterface $localizer */ $activeProfile->changeLanguage('en_GB'); $localizer->getLocale(); # en_GB $activeProfile->changeLanguage('cs_CZ'); $localizer->getLocale(); # cs_CZ
Contributing
Before committing any changes, don't forget to run
$ vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run
and
$ composer run tests
68publishers/i18n 适用场景与选型建议
68publishers/i18n 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.61k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 06 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「i18n」 「nette」 「environment」 「68publishers」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 68publishers/i18n 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 68publishers/i18n 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 68publishers/i18n 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Environment processor and contexts autoloader
Easy to use i18n translation PHP class for multi-language websites
The tenancy/tenancy identification driver using environment variables
A custom URL rule class for Yii 2 which allows to create translated URL rules
Multiple cascading environmental configuration files support for Laravel 5
An environment variable convenience library extension for vlucas/phpdotenv
统计信息
- 总下载量: 4.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-06