antenna/inline-translations 问题修复 & 功能扩展

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

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

antenna/inline-translations

Composer 安装命令:

composer require antenna/inline-translations

包简介

Inline translation package for laravel with plugins for blade & vue

README 文档

README

Screenshot of inline translation tool

This package enables you to manage translations and actually translate your Laravel application inline.

We advise you not to use this package in production environments. Translations can be managed within staging or development environments and synced to production with a custom implementation (or via your git repository).

Installation

Add the package as a dependency in your project:

composer require antenna/inline-translations

You must publish the configuration by running the command below. This will add the file config/inline-translations.php where you can configure the package. A Vue component will be published as well (resources/assets/vendor/v-inline-translations/app.js). You can use this as a Vue plugin for your vue instance. This is only needed if you use translations in your Vue components.

php artisan vendor:publish --tag=inline-translations

(Optional) use the Vue plugin. the methodName parameter defines the translation function that you use within your Vue components. This function will be overwritten by this package (when translation mode is active):

import VInlineTranslations from "resources/assets/vendor/v-inline-translations/app";
Vue.use(VInlineTranslations, {methodName: '__t'});
new Vue({
  ...
});

Don't forget to configure your supported languages in the configuration that was deployed (see underneath). By default this is configured to support one single language (English).

Configuration

This package has some configuration options. All configuration parameters have default values, so this package should work out of the box. Underneath you'll find the default configuration with explanation for all available parameters

return [
    'routes' => [
        /**
         * All paths of this package will be prefixed with the value defined in this parameter.
         * By default following paths can be used to activate or disable the tool:
         *   - /{prefix}/enable
         *   - /{prefix}/disable
         */
        'prefix'     => 'inline-translations',

        /**
         * Underneath you can define middleware that will be added to all routes of this package.
         * It might be sensible to add some kind of authentication in this middleware.
         */
        'middleware' => null,
    ],

    /**
     * The location where your translations are found, is defined in this parameter.
     * Laravel by default stores this in resources/lang
     */
    'translation_folder' => 'resources/lang',

    /**
     * This parameter defines the width of the widget when it is opened. This can be changed depending
     * on the amount of languages you are supporting, in order to get a better overview.
     */
    'widget_width' => 350,

    /**
     * Here you can define on which environments, translations are possible.
     * When the active environment is not in the array underneath, the tool will not be available.
     */
    'translation_environments' => ['local', 'staging'],
];

Technical

What can be translated inline?

This package comes out-of-the-box with the capability of managing the following translations

  • Blade (the default)
  • Vue

We would like to add other implementations in the future

Usage

We have tried to not only simplify the technical functionality of translation but also the workflow and management of the translations.

This has been done by an inline "widget" that can be collapsed. If open, this visualizes the keys and (already defined) translations that can be found on the page for every language that has been configured within the application.

In order to use the inline translation tool, you should surf to /inline-translations/enable, this will enable the tool. When you surf around your tool, you'll be able to do the translations via our interface. A button can be configured to enable / disable the tool if wanted.

In order to close the tool, surf to /inline-translations/disable

Todo

There are some things we would like to add in the future

antenna/inline-translations 适用场景与选型建议

antenna/inline-translations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.99k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 antenna/inline-translations 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-15