承接 hoku-lib/t5o 相关项目开发

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

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

hoku-lib/t5o

Composer 安装命令:

composer require hoku-lib/t5o

包简介

Very simple localization library. The meaning of T5o is Tagengo. Tagengo is Japanese. This has the same meaning as localization.

README 文档

README

T5o is a very simple PHP localization library. The meaning of T5o is Tagengo. Tagengo is Japanese. This has the same meaning as localization.

Installation

The recommended way to install T5o is through Composer.

composer require hoku-lib/t5o

Usage

There are two uses.

Use words with define.

<?php
require_once 'vendor/autoload.php';

$lang = 'fr';
$csvFilePath = dirname(__FILE__) . '/T5o.csv';
\T5o\T5o::define($csvFilePath, $lang);
// \T5o\T5o::define($csvFilePath, $lang, null, true); // auto htmlspecialchars!
?>
<!DOCTYPE html>
<html lang="<?=$lang?>">
<head>
    <meta charset="utf-8">
    <title>T5o</title>
</head>
<body>
    <h1><?=SITE_TITLE?></h1>
</body>
</html>

Use words with property.

<?php
require_once 'vendor/autoload.php';

$lang = 'fr';
$csvFilePath = dirname(__FILE__) . '/T5o.csv';
$T5o = new \T5o\T5o($csvFilePath);
$T5o->setLang($lang);
// $T5o->setLoggingUndefinedWordsMode(true); // logging!
// $T5o->setAutoHtmlspecialcharsMode(true); // auto htmlspecialchars!
?>
<!DOCTYPE html>
<html lang="<?=$lang?>">
<head>
    <meta charset="utf-8">
    <title>T5o</title>
</head>
<body>
    <h1><?=$T5o->SITE_TITLE?></h1>
</body>
</html>

CSV Format

  • First line:

    • In the leftmost column, enter T5o_LANG.
    • In the second and subsequent columns, enter the language.
  • From the second line:

    • Enter a unique identification key in the leftmost column.
    • In the second and subsequent columns, enter a word for each language.
T5o_LANG,en,ja,fr
HELLO,Hello,こんにちは,Bonjour
NAME,Name,名前,Nom
SITE_TITLE,T5o bulletin board,T5o掲示板,Tableau d'affichage T5o

Logging undefined words

$T5o = new T5o('mydir/t5o_csvfile.csv');
$T5o->setLang('en');

// If an undefined word is accessed, log is output.
// Log file name is "CSV_FILE_NAME + .undefined.log".
// ex. mydir/t5o_csvfile.csv.undefined.log
$T5o->setLoggingUndefinedWordsMode(true);

License

T5o is released under the MIT License. See the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固