定制 kiumars-babolhavaeji/simple-php-translator 二次开发

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

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

kiumars-babolhavaeji/simple-php-translator

最新稳定版本:v1.0.1

Composer 安装命令:

composer require kiumars-babolhavaeji/simple-php-translator

包简介

a package for translate names from a web resource

README 文档

README

SimpleTranslator is a lightweight and extensible PHP library for managing translations in multiple languages. It supports various file formats, dynamic configurations, caching, and features like pluralization and gender-specific translations.

Features

  • Dynamic Configurations: Customize settings via environment variables or config files.
  • Multi-Format Support: JSON, YAML, and XML translation files are supported.
  • Fallback Language: Automatically falls back to a default language if a translation file is missing.
  • Error Handling: Gracefully handles missing or unreadable files and keys.
  • Caching: Reduces repeated lookups by caching translations.
  • Pluralization and Gender-Specific Translations: Adapts based on count and gender.

installation

The package is available on github and packagist, so for install and use this package you just need to install it by composer :

composer require kiumars-babolhavaeji/simple-php-translator

Usage

  1. Configure the Library Set environment variables for dynamic configurations:
export TRANSLATOR_LANGUAGE=en
export TRANSLATOR_TYPE=.json
export TRANSLATOR_ROOT=/path/to/translations
  1. Translation Example
use SimpleTranslator\Lang;

echo Lang::translate('hello'); // Output: Translation of 'hello'
echo Lang::translate('apple', ['count' => 2]); // Output: Apples (based on pluralization)
echo Lang::translate('actor', ['gender' => 'female']); // Output: Actress

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固