jbtronics/translation-editor-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jbtronics/translation-editor-bundle

Composer 安装命令:

composer require jbtronics/translation-editor-bundle

包简介

A symfony bundle to allow editing translations in the symfony profiler

README 文档

README

GitHub License

Profiler Translation Editor Bundle

This bundle provides a way to edit the translations of your Symfony application directly from the Symfony profiler.

Animated Showcase

This bundle is inspired by the php-translation/symfony-bundle, which offers a similar feature, but has more dependencies and is more complex to use. This bundle provides a simpler and more modern alternative to this, which supports the latest Symfony versions and slightly faster.

Requirements

  • PHP 8.1 or higher
  • Symfony 6.4 or higher (compatible with Symfony 7)

Installation

You can install this bundle using composer:

composer require --dev jbtronics/translation-editor-bundle

Note the --dev flag, as this bundle is only intended for development and debugging purposes.

If you are using Symfony Flex, the bundle will be automatically enabled. If not, you have to enable it manually in your config/bundles.php:

return [
    // ...
    Jbtronics\TranslationEditorBundle\JbtronicsTranslationEditorBundle::class => ['dev' => true],
];

Please note that this bundle should only be enabled in the dev environment.

You also need to enable the required routes for your bundle. You can do this by creating a new file in your config/routes directory (e.g. config/routes/jbtronics_translation_editor.yaml):

# config/routes/jbtronics_translation_editor.yaml

when@dev:
    translation_editor:
      resource: '@JbtronicsTranslationEditorBundle/config/routes.php'

Configuration

If you do not use the standard paths for your translation files, or not the XLF format, you have to configure the bundle to generate the right files. If you just use the standard paths and XLF format, the defaults should be fine for you, and you can skip this step and you do not need to create a configuration file.

Otherwise create a new file in your config/packages directory (e.g. config/packages/jbtronics_translation_editor.yaml) and configure the options you need (here the default values are shown):

# config/packages/jbtronics_translation_editor.yaml

jbtronics_translation_editor:

  # The path where the translation files are stored (normally %kernel.project_dir%/translations)
  translations_path: "%translator.default_path%"

  # The format in which the translation files should be outputted
  format: yaml

  # The version of the XLIFF format to use
  xliff_version: 2.0

  # Any additional options that should be passed to the translation writer. This depends on the format you use.
  writer_options:
    #as_tree: true

  # Use Intl message format
  use_intl_icu_format: false

Usage

After you have installed and configured the bundle, just open the Symfony profiler for the request you want the translations to edit. In the table with the messages, you will see a new column with an edit button. Click on this button to open a editor for the message and click save to save the changes.

After submission the field is colored blue, while the changes are saved. If the changes were saved sucessfully, the field will turn green for a short time, otherwise red if an error occurred.

Security

The endpoint for the translation editor is not protected. Anybody who can access the web application and the profiler can edit the translations, with all consequences. As translations are not necessarily translated, this could allow attackers to inject malicious code as an XSS attack.

However, this bundle, similar to the Symfony profiler itself, is only intended for development and debugging purposes and should only run in a dedicated development environment, where only trusted users have access (and could modify the code directly anyway). Therefore, the security risk should be minimal in the intended use case.

This bundle enforces the dev environment, so it should not be possible to use it in a production environment. Anyway, you should make sure that the bundle and especially the translation editor endpoint must not be accessible in a production environment.

License

SettingsBundle is licensed under the MIT License. This mostly means that you can use this bundle for whatever you want (even use it commercially) as long as you retain the copyright/license information.

See LICENSE for more information.

jbtronics/translation-editor-bundle 适用场景与选型建议

jbtronics/translation-editor-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.71k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2024 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 jbtronics/translation-editor-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 30.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-03