承接 syntaxseed/translator 相关项目开发

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

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

syntaxseed/translator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require syntaxseed/translator

包简介

Translate strings in your application to multiple languages loaded from JSON files.

README 文档

README

GitHub tag (latest SemVer)   PHP v8.0+   PHP v8.1+   License: MIT
follow on Twitter  Sponsor Project

Load JSON language files and translate them in your application.

Features

  • Easy to use, just set language and point to a JSON file.
  • Uses the primary language as the lookup key, so strings are understandable in your application.
  • Add any number of languages with a language key.
  • All the translations for one string are in the same file/place.
  • Fails silently - untranslated strings will just output the lookup string.
  • Load more than one language file for different parts of your application.
  • Short translation function name (get) for easy typing.
  • Switch target language when needed.

Install

Via Composer:

composer require syntaxseed/translator

Or add to composer.json:

"require": {
    "syntaxseed/translator": "^1.0"
},

Usage

For a more in-depth example, see examples/ directory.

use Syntaxseed\Translator\Translator;

require('../src/Translator.php');

// Initialize with base (lookup) language and target language to translate to.
$translations = new Translator('en', 'fr');
// Load a JSON file to the default lookup key.
$translations->loadLanguageFile(__DIR__.'/lang.json');

echo($translations->get('Hello World'));

Language File JSON Format

{
    "Email address" : {
        "fr" : "Addresse courriel",
        "es" : "Dirección de correo electrónico"
    },
    "Last name" : {
        "fr" : "Nom de famille",
        "es" : "Apellido"
    },
    "Your name" : {
        "fr" : "Votre nom",
        "es" : "Su nombre"
    }
}

Changelog

  • v1.0.0 - (2018-10-27) Created. Added to GitHub.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固