anourvalar/laravel-interpreter
Composer 安装命令:
composer require anourvalar/laravel-interpreter
包简介
Laravel's locales translate through the single (flat) file
README 文档
README
- Export all untranslated phrases from your project to a single file for a translator.
- Import all translated phrases from a single file to your project's structure.
- Find & wrap text phrases with missed @lang() directive in your blade templates.
Installation
composer require anourvalar/laravel-interpreter --dev
Usage: basic flow
Step #1: Create schema (config) for a target locale
php artisan interpreter:schema ru
Step #2: Fill in the config
{
"source_locale": "en", // reference (source) locale
"target_locale": "ru",
"adapter": "AnourValar\\LaravelInterpreter\\Adapters\\JsonAdapter",
"filename": "ru_i18.json",
"include_json": true, // include phrases from lang/en.json
"lang_files": {
"exclude": [],
"include": [
"/admin/" // include all files inside directory lang/en/admin/*
],
"exclude_keys": []
},
"view_files": {
"exclude": [],
"include": [
"/admin/" // include all files (parse phrases) inside directory views/admin/*
]
},
"vendor_view_files": {
"exclude": [],
"include": ["/anourvalar/laravel-form/"] // include all files inside directory vendor/*
},
"exclude_phrases": ["ID", "Email", "E-Mail"],
"include_pattern": null // "white" filter (regexp)
}
Step #3: Export untranslated phrases to a single file for a translator
php artisan interpreter:export ru
This command also display all unwrapped (with missing @lang) phrases.
Step #4: Import the completed single file to the project's structure
php artisan interpreter:import ru
Usage: wrap
php artisan interpreter:wrap resources/views/test.blade.php
Original template
<div>Привет, Мир!</div>
Modified template
<div>@lang('Привет, Мир!')</div>
anourvalar/laravel-interpreter 适用场景与选型建议
anourvalar/laravel-interpreter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.93k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「import」 「locale」 「export」 「laravel」 「localization」 「trans」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 anourvalar/laravel-interpreter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 anourvalar/laravel-interpreter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 anourvalar/laravel-interpreter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Package for convenient work with Laravel's localization features
Bulk export of sylius resources
Parse use statements for a reflection object
Tool for copying data from a production database to a dev database. Also useful for making backups of production databases.
A fork of konnco/filament-import with support of Laravel 11 since the default importer of Filament 3 is nonsense for basic use case.
Yii2 export extension
统计信息
- 总下载量: 5.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-26