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 1w 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

2250d 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

[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)[statikbe/laravel-chained-translator

The Laravel Chained Translator can combine several translators that can override each others translations.

36149.4k6](/packages/statikbe-laravel-chained-translator)

PHPackages © 2026

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