oscar-team/laravel-langman
Composer 安装命令:
composer require oscar-team/laravel-langman
包简介
Manage language files with ease. (forked from @themsaid)
README 文档
README
Langman is a language files manager in your artisan console, it helps you search, update, add, and remove
translation lines with ease. Taking care of a multilingual interface is not a headache anymore.
This is a fork of https://github.com/themsaid/laravel-langman
Installation
Begin by installing the package through Composer. Run the following command in your terminal:
composer require oscar-team/laravel-langman
Once done, add the following line in your providers array of config/app.php:
Themsaid\Langman\LangmanServiceProvider::class
This package has a single configuration option that points to the resources/lang directory, if only you need to change
the path then publish the config file:
php artisan vendor:publish --provider="Themsaid\Langman\LangmanServiceProvider"
Usage
Showing lines of a translation file
php artisan langman:show users
You get:
+---------+---------------+-------------+
| key | en | nl |
+---------+---------------+-------------+
| name | name | naam |
| job | job | baan |
+---------+---------------+-------------+
php artisan langman:show users.name
Brings only the translation of the name key in all languages.
php artisan langman:show users.name.first
Brings the translation of a nested key.
php artisan langman:show package::users.name
Brings the translation of a vendor package language file.
php artisan langman:show users --lang=en,it
Brings the translation of only the "en" and "it" languages.
php artisan langman:show users.nam -c
Brings only the translation lines with keys matching the given key via close match, so searching for nam brings values for
keys like (name, username, branch_name_required, etc...).
In the table returned by this command, if a translation is missing it'll be marked in red.
Finding a translation line
php artisan langman:find 'log in first'
You get a table of language lines where any of the values matches the given phrase by close match.
Searching view files for missing translations
php artisan langman:sync
This command will look into all files in resources/views and app and find all translation keys that are not covered in your translation files, after
that it appends those keys to the files with a value equal to an empty string.
Create missing translation files from collected keys
php artisan langman:sync --create
Filling missing translations
php artisan langman:missing
It'll collect all the keys that are missing in any of the languages or has values equals to an empty string, prompt asking you to give a translation for each, and finally save the given values to the files.
Translating a key
php artisan langman:trans users.name
php artisan langman:trans users.name.first
php artisan langman:trans users.name --lang=en
php artisan langman:trans package::users.name
Using this command you may set a language key (plain or nested) for a given group, you may also specify which language you wish to set leaving the other languages as is.
This command will add a new key if not existing, and updates the key if it is already there.
Removing a key
php artisan langman:remove users.name
php artisan langman:remove package::users.name
It'll remove that key from all language files.
Renaming a key
php artisan langman:rename users.name full_name
This will rename users.name to be users.full_name, the console will output a list of files where the key used to exist.
Notes
langman:sync, langman:missing, langman:trans, and langman:remove will update your language files by writing them completely, meaning that any comments or special styling will be removed, so I recommend you backup your files.
Web interface
If you want a web interface to manage your language files instead, I recommend Laravel 5 Translation Manager by Barry vd. Heuvel.
oscar-team/laravel-langman 适用场景与选型建议
oscar-team/laravel-langman 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.92k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「localization」 「multilingual」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oscar-team/laravel-langman 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oscar-team/laravel-langman 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oscar-team/laravel-langman 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Package for convenient work with Laravel's localization features
Field for number with restricted count of digits and decimal places
Deepl Automated translations for Laravel lang files
i18n tools for SilverStripe
Manage language files with ease.
Adds localization support to laravel applications in an easy way using Poedit and GNU gettext.
统计信息
- 总下载量: 4.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-23