定制 simp/translate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

simp/translate

最新稳定版本:v1.0.3

Composer 安装命令:

composer require simp/translate

包简介

This is packages of simp content manager for translation

README 文档

README

A PHP library for easy text translation between different languages using Google Translate API with caching support.

Installation

Install the package via composer:

   composer require simp/translate

Usage

Basic usage

    require_once 'vendor/autoload.php';
    
    // Note: this will use the default translation languages, i.e., en to fr
    echo Translate::translate('Hello, How are you?');

Advance usage

   
   require_once 'vendor/autoload.php';
   
   //Note: here we are manually setting the output language ie the original text is english which will be translated to Nyanja (Chichewa)
   echo Translate::translate('Hello, How are you?', to: 'ny');
   
   // This is also possible.
   echo Translate::translate('Moni', from: 'ny', to: 'en');
   
   // Sometimes you will need to just save the translation result some where to reuse it, in that way you dont have ask google to translate everytime.
   echo Translate::translate('Hello, How are you?', to: 'ny', cacheLocation: __DIR__.'/cache');

Maintainer

Chance Nyasulu

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-07