vinou/translations
Composer 安装命令:
composer require vinou/translations
包简介
Vinou Translation files
关键字:
README 文档
README
The Vinou platform itself depends on this library and therefore it is continuously integrated and right under development. Regarding this the translation files contains work on every period of our platform work.
The following README documents the current status quo of translation definition rules. Regarding the huge amount of language keys and other webprojects that are depending on older coding guidelines the translation files looks sometimes really confusing.
Table of contents
- 1. Contribution
- 2. Coding Guidelines
- 3. Standard object keys
- 4. Object example
- 5. Twig extension
- Provider
1. Contribution
If you want to contribute, feel free to join and create pull request. We want to be sure that most of depending web projects could easily be updated, therefore it could take some time that your work is added. Feel free to contact us via PN, mail to kontakt@vinou.de or phone call to +49 61316245390.
2. Coding Guidelines
- If A key is used for an array of keys it is always plural, for example countries or wineRegions
- If A key identifies an Object or only a String it is always singular, for example wine, product, bundle
- All identifiers have to be lowerCamelCase. Hyphens, underscores or other separators are not allowed. In special cases ids may be used when translation represents static database objects like grapeTypes.
- If an object is used in more than two other objects, it may be defined under the general object
- If an object containes multiple static options the values should be defined in the parent object as array, for example: the product object has a field type with 3 static options, the options should be defined as "types" in object "product".
- All keys should be in alpha numerical order, except properties of base objects (see below).
"product": { "fields": { "type": "Type of product" }, "types": { "optionOne": "Option 1", "optionTwo": "Option 2", "optionThree": "Option 3" } }
3. Standard object keys
Each object may define certain standard keys shown below in preferred definition order.
| key | description |
|---|---|
| name | Singular and plural names of an entity |
| actions | Special actions available for this object. Actions may be defined as single string or object of the following form: |
| actions.[ACTION].main | First line of action button in application |
| actions.[ACTION].sub | Second line of action button in application |
| fields | Field indentifiers normally a string directly used as label |
| fields.[FIELD].label | Label for form field if more than a label is defined for a field |
| fields.[FIELD].placeholder | Placeholder for form field |
| fields.[FIELD].hint | Special hint for a form field |
| fieldSets | Form areas to devide fields into seperate sections |
| views | Special defined views like pages, tabs, ... |
| filters | Filter properties used in view, tab oder fieldSet |
| dialogs | Dialog texts regarding this object |
| toasts | Toasts regarding this object. Toast keys shall be defined in past tense for standard toasts or present tense followed by "Error" for error toasts |
| hints | Hints for this object in views, tabs, fieldsets |
| [xyzTypes] | Object related types or categories |
4. Object example
"bundle": { "name": { "singular": "Weinpaket", "plural": "Weinpakete" }, "actions": { "addItem": "+ Artikel hinzufügen", "create": { "main": "Neues Weinpaket", "sub": "anlegen" } }, "fields": { "active": "aktiv", "articleNumber": { "label": "Art.-Nr.", "placeholder": "SKU 000 - 0000000" }, "category": "Kategorie", "description": "Beschreibung", "sorting": "Manueller Sortierindex (z.B. für den Shop)" }, "fieldSets": { "facts": "Daten & Fakten", "general": "Allgemeines", "items": "Artikel" }, "views": { "create": { "title": "Neues Weinpaket erstellen" }, "files": { "title": "Dateien", "empty": "Es liegen keine {label} zu diesem Weinpaket vor." } }, "filters": { "category": { "label": "Kategorie auswählen", "none": "Pakete ohne Kategorie anzeigen" }, "search": { "placeholder": "z.B. Name, Beschreibung" }, }, "dialogs": { "delete": "Möchtest Du dieses Weinpaket wirklich löschen?" }, "toasts": { "changed": "Weinpaket geändert!", "changeError": "Weinpaket konnte nicht geändert werden!", "created": "Weinpaket angelegt!", "createError": "Weinpaket konnte nicht angelegt werden!", "deleted": "Weinpaket gelöscht!", "deleteError": "Weinpaket konnte nicht gelöscht werden!", "imageDeleted": "Bild zum Weinpaket gelöscht", "imageUploaded": "Bild zum Weinpaket hochgeladen!" }, "hints": { "imageSize": "<b>Empfehlung für optimale Darstellung</b><br>Abmessungen: 1500x1500px<br/>Datei-Format: .png (freigestellt)" }, "packageTypes": { "mixed": "Gemischt", "surprise": "Überaschungspaket", "wineOnly": "Nur Wein", } }
5. Twig Extension
This library also contains a Twig extension. To implement this extension you can use this code.
$languageKey = 'de'; $twig = new \Twig\Environment(); $twig->addExtension(new \Vinou\Translations\TwigExtension($languageKey));
Afterwards you can use the translate filter in your template like this:
<p id="wine"> <a class="action-button"> <span class="main">{{ 'wine.actions.create.main' | translate }}</span> <span class="sub">{{ 'wine.actions.create.sub' | translate }}</span> </a> </p>
Provider
This Library is developed by the Vinou GmbH.
Vinou GmbH
Mombacher Straße 68
55122 Mainz
E-Mail: kontakt@vinou.de
Phone: +49 6131 6245390
vinou/translations 适用场景与选型建议
vinou/translations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.41k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「translations」 「Vinou」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vinou/translations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vinou/translations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vinou/translations 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Deepl Automated translations for Laravel lang files
PHP library to generate template based webpages with dynamic content from the Vinou Plattform
Vinou API Connnector
Adds support for dynamic translations from Google Spreadsheets.
A Laravel package for multilingual models
TranslationBundle bundle
统计信息
- 总下载量: 1.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2020-09-09