承接 kamal-abouzayed/quick-translate 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kamal-abouzayed/quick-translate

最新稳定版本:v1.0.0

Composer 安装命令:

composer require kamal-abouzayed/quick-translate

包简介

Easily integrate Google Translate API with Laravel to automate multilingual translations across your app.

README 文档

README

QuickTranslate is a Laravel package that enables easy translation of words into multiple languages using Google Translate. It simplifies the process of managing translations for your application.

Table of Contents

Installation

To install the package, run the following command in your Laravel project's root directory:

composer require kamalabouzayed/quicktranslate

Register the Service Provider

If you're using Laravel 5.4 or below, you need to register the service provider in your config/app.php file. Add the following line to the providers array:

'providers' => [
    // ...
    KamalAbouzayed\QuickTranslate\QuickTranslateServiceProvider::class,
],

Starting from Laravel 5.5, package auto-discovery is supported, so you can skip this step.

Publish the Configuration

To customize the package settings, publish the configuration file by running the following command:

php artisan vendor:publish --provider="KamalAbouzayed\QuickTranslate\QuickTranslateServiceProvider" --tag=config

This command will create a configuration file at config/quick-translate.php. You can set the supported locales and the path to the translations file in this config file.

Example Configuration

Here’s an example configuration you might use:

<?php

return [

    /**
     * Set array of supported locales.
     *
     * @var array
     */
    'locales' => [
        'en',
        'ar',
    ],

    /**
     * Set path to translations file.
     *
     * @var string
     */
    'translationsFile' => storage_path('app/translations.json'),
];

Usage

You can utilize the translation functionality by calling the translate function.

Example

Here’s how you can translate a word using the package:

<?php

$word = translate('Hello');

echo $word;

// Output: Depends on the current application locale
// ar => مرحبا
// en => Hello

License

This package is licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固