Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-lang

> 后端框架
Open source

:earth_asia: 75 languages support for Laravel application.

1.3K stars0 likes1 views
WebsiteGitHub

About

:earth_asia: 75 languages support for Laravel application.

Laravel-lang

75 languages support for Laravel application based on Laravel-Lang/lang.

Warning

There is already a better solution to use our official Laravel-Lang publisher. This project will be discontinued, thank you for your support.

Features

  • Laravel 5+ && Lumen support.
  • Translations Publisher.
  • Made with .

Install

Laravel version Composer command
Laravel 9.x composer require overtrue/laravel-lang:~6.0
Laravel 7.x-8.x composer require overtrue/laravel-lang:~5.0
Laravel 6.x composer require overtrue/laravel-lang:~4.0
Laravel 5.8 composer require overtrue/laravel-lang:~3.0
Laravel 5.1-5.7 composer require overtrue/laravel-lang:~2.0
Laravel 5 composer require overtrue/laravel-lang:~1.0
bash
composer require "overtrue/laravel-lang:~6.0"

Lumen

Add the following line to bootstrap/app.php:

php
$app->register(Overtrue\LaravelLang\TranslationServiceProvider::class);

Configuration

Laravel

you can change the locale at config/app.php:

php
'locale' => 'zh_CN',

Lumen

set locale in .env file:

APP_LOCALE=zh_CN

Usage

There is no difference with the usual usage.

If you need to add additional language content, Please create a file in the resources/lang/{LANGUAGE} directory.

Add custom language items

Here, for example in Chinese:

resources/lang/zh_CN/demo.php:

php
 '用户不存在',
    'email_has_registed' => '邮箱 :email 已经注册过!',
];

Used in the template:

php
echo trans('demo.user_not_exists'); // 用户不存在
echo trans('demo.email_has_registed', ['email' => '[email protected]']);
// 邮箱 [email protected] 已经注册过!

Replace the default language items partially

We assume that want to replace the password.reset message:

resources/lang/zh_CN/passwords.php:

php
 '您的密码已经重置成功了,你可以使用新的密码登录了!',
];

You need only add the partials item what you want.

publish the language files to your project resources/lang/ directory

bash
php artisan lang:publish [LOCALES] {--force}

examples:

bash
php artisan lang:publish zh_CN,zh_HK,th,tk

:heart: Sponsor me

如果你喜欢我的项目并想支持它,点击这里 :heart:

Project supported by JetBrains

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPi18nlaravellocalization

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架