alessandrobelli/lingua 问题修复 & 功能扩展

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

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

alessandrobelli/lingua

Composer 安装命令:

composer require alessandrobelli/lingua

包简介

Translation Manager for Laravel, built with TALL stack.

README 文档

README

Lingua Banner

👅 Lingua

Translation Manager for Laravel, built with TALL stack.

🇮🇹 From Italian: Lingua means both Tongue and Language

Latest Version on Packagist GitHub Tests Action StatusTotal Downloads Total Downloads

Lingua is a dashboard that allows you to create, manage and import your translations for your project.

This package is in pre-release with known issues. Please report them.

The new Release - 0.3 - bring a lot of changes, mainly in the interface. Screenshots here still outdated.

I would like to warmly thank Spatie and Freek to have taught me how to develop packages.

Requirements

  1. Install AlpineJS and include it in your JS file.
  2. Install Livewire.
  3. Then you can install the package via composer.

Installation

composer require alessandrobelli/lingua

This package needs a column called linguaprojects on the user table, as well as a table "translations".

You can publish and run the migrations with:

php artisan vendor:publish --provider="alessandrobelli\Lingua\LinguaServiceProvider" --tag="migrations"
php artisan migrate

Usage

You need to add the routes to your web.php file.

Route::lingua('desiredslug');

Then you can go to /desiredslug to see the dashboard.

Lingua_Dashboard

To use the translation files for Javascript files place this into your header:

    <script>
        window.trans = [];
        window.trans = <?php
        if(File::exists(resource_path() . "/lang/" . App::getLocale() . '.json'))
        {
            $json_file = File::get(resource_path() . "/lang/" . App::getLocale() . '.json');
            echo json_decode(json_encode($json_file, true));
        }
        else{
            echo "[]";
        }
        ?>;
    </script>

Then make a prototype function in Javascript to detect the trans() function inside your Javascript files, or use this, in case you use Vuejs and Lodash:

Vue.prototype.trans = (key) => {
    if (_.isUndefined(window.trans[key])) {
        return key;
    } else {
        if (window.trans[key] === "") return key;
        return window.trans[key];
    }
};

The language shown will be according to the locale of the browser, or you can use this tutorial which worked for me.

More

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@alessandrobelli.it instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固