diamochang/i7h-php

Implement RimoChan's own i18nglish in PHP without worrying about XSS attacks.

dev-m2n 2024-05-05 04:13 UTC

This package is auto-updated.

Last update: 2025-06-05 06:45:17 UTC


README

简体中文 | 繁體中文

PHP CI Scrutinizer Code Quality PHP Version Support Packagist Stars

This project can implement i18nglish, which was created by RimoChan, in PHP without worrying about XSS attacks.

How it works

The example text is taken from Richard M. Stallman's Free Software Song lyrics.

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.

(Note: I added the apostrophe in "We'll" myself, it was originally lost in the escaping process.)

How to use it

  1. git clone the entire repository. If it's slow, try changing hub to ee in the Git URL to use the Gitee mirror. You can also use Composer: composer require diamochang/i7h-php.
  2. Move i7h.php to your project. If you installed it with Composer, this step can be skipped.
  3. Add the dependency to the code you want to use:
// Please refer to the actual location of i7h.php.
require_once "i7h.php";
  1. Call it with the following code:
// Instantiate the i7h class
$i7h = new i7h();

// Call the i18n method to process the string and output the result.
echo $i7h->i18n('what you want to convert')
  1. The job is done.

Known Issues

  • English apostrophe may be lost in the escape process

Contributions

PRs are welcome, Issues are welcome.

License

MIT (Expat) License