lafourchette/l10n-bundle
最新稳定版本:v1.7.1
Composer 安装命令:
composer require lafourchette/l10n-bundle
包简介
A bundle to manage localization
关键字:
README 文档
README
Overview
The aim of L10nBundle is to provide a very simple way to deal with L10N, like I18N with Symfony translator.
L10N data can be store wherever you want. Currently, L10nBundle supports YaML file and MongoDb.
Configuration
Global
l10n:
localization_fallback: en # Fallback localization, used when no explicit Localization is asked or localization not found. Value may be string or integer
locale_fallback: en_US # Fallback locale, to manage L10N values
manager: yaml # The name of the manager you want to use currently yaml or mongodb
You can use the parameters of your symfony configuration in your values. Example:
#parameters.yml
parameters:
my_environment_extension: local
#l10n.yml
l10n:
my_url:
gb: www.domain.%my_environment_extension%
The value will be resolved like this:
my_url => www.domain.local
yaml
yaml:
data_file: /path/to/main.yaml
You can import files
imports:
- { resource: "../../src/Bundle/MyBundle/Resources/translations/l10n.yml" }
Configuration is under l10n key
l10n:
registration:
label:
fr: FRA
es: SPA
name:
fr: french name
es: spanish name
You can use the keys registration.label and registration.name.
Simple translation is provided
Use an array as value:
l10n:
registration.label:
fr:
- {locale: fr, value: FRA_fr}
- {locale: en, value: FRA_en}
mongodb
mongodb:
host: 127.0.0.1
port: 27017
username: test
password: T3$t
database: test_db
Usage
PHP
Example in a controler
$l10n = $this->getContainer()->get('l10n_bundle.business.l10n_provider');
$l10n->getL10n('key', 'idLoc');
Twig
In a twig template you can use the l10n filter
{{ 'key'|l10n }}
You can also provide parameters such as the default localization and/or the locale.
{{ 'key'|l10n('es', 'ca') }}
lafourchette/l10n-bundle 适用场景与选型建议
lafourchette/l10n-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 74.36k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2014 年 07 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「l10n」 「localization」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lafourchette/l10n-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lafourchette/l10n-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lafourchette/l10n-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Package for convenient work with Laravel's localization features
Field for number with restricted count of digits and decimal places
Easy to use internationalization functions for Laravel
Deepl Automated translations for Laravel lang files
Symfony2 Bundle Moment.js - Parse, validate, manipulate, and display dates in JavaScript
WordPress mu-plugin for a faster load_textdomain.
统计信息
- 总下载量: 74.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2014-07-08