PHPackages                             xiv/language - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. xiv/language

ActiveLibrary[Localization &amp; i18n](/categories/localization)

xiv/language
============

Xiv-Tinkphp

v0.1(6y ago)06MITPHP

Since Mar 20Pushed 6y agoCompare

[ Source](https://github.com/xivcm/xiv)[ Packagist](https://packagist.org/packages/xiv/language)[ RSS](/packages/xiv-language/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

xiv
===

[](#xiv)

\#Thinkphp6.0中文繁简体切换

\#composer require xiv/language

\#use Xiv\\xiv;

\#vendor/topthink/src/think/Response.php

\#/\*

\#\*getContent方法返回值之前添加

\#\*$xiv=new xiv();

\#\*$this-&gt;content=$xiv-&gt;zh\_auto($this-&gt;content);

\#\*/

\#Thinkphp6.0所有程序返回结果皆会被转换，

\#但是不包含半路打印的print\_r echo exit输出等等。

public function getContent(): string
====================================

[](#public-function-getcontent-string)

```
{
    if (null == $this->content) {

        $content = $this->output($this->data);

        if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
            $content,
            '__toString',
        ])
        ) {

            throw new \InvalidArgumentException(sprintf('variable type error： %s', gettype($content)));

        }

        $this->content = (string) $content;

    }

    return $this->content;

}

```

public function getContent(): string

```
{

    if (null == $this->content) {

        $content = $this->output($this->data);

        if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
            $content,
            '__toString',
        ])
        ) {

            throw new \InvalidArgumentException(sprintf('variable type error： %s', gettype($content)));

        }

        $this->content = (string) $content;

    }

    $xiv=new xiv();

    $this->content=$xiv->change($this->content);

    return $this->content;

}

```

以Thinkphp默认页做Demo

thinkphp/app/controller/index.php

测试内容如下

访问  简体转换为繁体

访问  简体中文转换为英文

其他语言支持正在扩展中

---

namespace app\\controller;

use app\\BaseController;

use think\\Request;

class Index extends BaseController

{

```
public function index()

{

    return '*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px } :) 2020新春快乐 ThinkPHP V' . \think\facade\App::version() . '14载初心不改 - 你值得信赖的PHP框架[ V6.0 版本由 亿速云 独家赞助发布 ]';

}

public function hello($name = 'ThinkPHP6')

{

    return 'hello,' . $name;

}

public function language(){

	$la=$this->request->param('la');

	$to=$this->request->param('to');

	\think\facade\Session::set('Translate_from',$la);

	\think\facade\Session::set('Translate_to',$to);

	return $this->index();

}

```

}

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2296d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ca82d864122ba87a4bed82dc3664f658cfe8e932f4f7c1fe74d974dd19a219d?d=identicon)[xivcm](/maintainers/xivcm)

---

Top Contributors

[![xiao-jiuma](https://avatars.githubusercontent.com/u/265048086?v=4)](https://github.com/xiao-jiuma "xiao-jiuma (10 commits)")

---

Tags

thinkphpXiv

### Embed Badge

![Health badge](/badges/xiv-language/health.svg)

```
[![Health](https://phpackages.com/badges/xiv-language/health.svg)](https://phpackages.com/packages/xiv-language)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1927.0k1](/packages/smmoosavi-php-gettext)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
