1 Star 0 Fork 0

Mike Wang / i7h-PHP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

i7h-PHP

PHP CI Scrutinizer Code Quality PHP Version Support Packagist Stars

这个项目可以在 PHP 中实现莉沫酱自创的 i18nglish,且不用担心 XSS 攻击。

使用效果

示例文本取自 Richard M. Stallman 的《自由软件之歌》英文歌词

Before:

When we have enough free software
At our call, hackers, at our call,
We'll kick out those dirty licenses
Ever more, hackers, ever more.

After:

W2n we h2e e4h f2e s6e
At o1r c2l, h5s, at o1r c2l,
We'll k2k o1t t3e d3y l6s
E2r m2e, h5s, e2r m2e.

(注:“We'll”中的撇号是我自己加的,原本这个撇号在转义过程中丢失了。)

使用方法

  1. git clone整个仓库。如果速度缓慢,可以试着把 Git URL 中的hub改为ee以使用码云镜像。也可以使用 Composer:composer require diamochang/i7h-php
  2. i7h.php移动到你的项目。如果你是用 Composer 安装的,这步可以跳过。
  3. 在欲使用的代码中添加依赖:
// 请以实际存放 i7h.php 的位置为准
require_once "i7h.php";
  1. 使用以下代码调用:
// 实例化 i7h 类
$i7h = new i7h();

// 调用 i18n 方法处理字符串,并输出结果
echo $i7h->i18n('你要转换的内容')
  1. 大功告成。

已知问题

  • 英文撇号在转义过程中可能会丢失

贡献

欢迎 PR,欢迎 Issues。

许可证

MIT (Expat) License

MIT License Copyright (c) 2024 Mike Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

在 PHP 中实现莉沫酱自创的 i18nglish,且不用担心 XSS 攻击。 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/Diamochang/i7h-PHP.git
git@gitee.com:Diamochang/i7h-PHP.git
Diamochang
i7h-PHP
i7h-PHP
m2n

搜索帮助