承接 digicraft/laralang 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

digicraft/laralang

Composer 安装命令:

composer require digicraft/laralang

包简介

Manage language files with ease.

README 文档

README

Laralang is a language files manager in your artisan console based on Laravel Langman, it helps you search, update, add, and remove translation lines with ease. Taking care of a multilingual interface is not a headache anymore.

Laravel Laralang

Installation

Begin by installing the package through Composer. Run the following command in your terminal:

$ composer require digicraft/laralang

Once done, add the following line in your providers array of config/app.php:

Digicraft\Laralang\LaralangServiceProvider::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="Digicraft\Laralang\LaralangServiceProvider"

Usage

Showing lines of a translation file

php artisan laralang:show users

You get:

+---------+---------------+-------------+
| key     | en            | nl          |
+---------+---------------+-------------+
| name    | name          | naam        |
| job     | job           | baan        |
+---------+---------------+-------------+
php artisan laralang:show users.name

Brings only the translation of the name key in all languages.

php artisan laralang:show users.name.first

Brings the translation of a nested key.

php artisan laralang:show package::users.name

Brings the translation of a vendor package language file.

php artisan laralang:show users --lang=en,it

Brings the translation of only the "en" and "it" languages.

php artisan laralang: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 laralang: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 laralang: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.

Filling missing translations

php artisan laralang: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 laralang:trans users.name
php artisan laralang:trans users.name.first
php artisan laralang:trans users.name --lang=en
php artisan laralang: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 laralang:remove users.name
php artisan laralang:remove package::users.name

It'll remove that key from all language files.

Renaming a key

php artisan laralang: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

laralang:sync, laralang:missing, laralang:trans, and laralang: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.

To Do

  • Web interface
  • Default Lang files
  • Command for new file creation in all langs
  • Database working system
  • Config for switch inter DB and Files

Thanks

This library is based on the work by Mohamed Said, and carried out to extend the project initiated by him, as well as to support the new versions of Laravel Framework

digicraft/laralang 适用场景与选型建议

digicraft/laralang 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 465 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「localization」 「multilingual」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 digicraft/laralang 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 digicraft/laralang 我们能提供哪些服务?
定制开发 / 二次开发

基于 digicraft/laralang 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 465
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-18