定制 joeri-abbo/laravel-easy-translations 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

joeri-abbo/laravel-easy-translations

Composer 安装命令:

composer require joeri-abbo/laravel-easy-translations

包简介

Laravel laravel-easy-translations support

README 文档

README

Laravel Easy Translations

Test Test Test Test Test

Getting Started

Prerequisites

  • Php 8 and up
  • Laravel 9

Installation

To get started require the package with composer.

composer require joeri-abbo/laravel-easy-translations

After installing the package in to your laravel project run the command below to add the config and create the language folder.

php artisan laravel-easy-translations:install

You can custom the dir for the language file storage by editing the config setting storage_path to your wanted path. After changing this setting the dir automatically will be generated when a transulation is called. You can also force it by running

php artisan laravel-easy-translations:install

Usage

You can easily use the translate function in your application. The first parameter is required the second one is your language pack. Default it uses your default set in the config. If you do not change this it will be english.

<?php
echo translate('String to translate')
?>

If you want to translate to your custom language pack it is as easy as adding the second parameter for the language pack like below

<?php
echo translate('String to translate','dutch')
?>

To change the default pack on your web pack it is as easy to change the value inside the Language helper class like below. The translated sting will be in the set language pack. If it is not found it will return the given string.

<?php
\JoeriAbbo\LaravelEasyTranslations\Helper\LanguageHelper::getInstance()->setLanguage('dutch')

echo translate('String to translate')
?>

You can translate the json file by your editor but there is also a view for this. To access this view your application env needs to be value APP_ENV needs to be local. The url is base_url/laravel-easy-translations this view shows the found languages and the option to edit these translations.

You can also automatic translate your application by using the command below. It wil use Google translate to translate your given base language pack

php artisan laravel-easy-translations:translate-file

Releases

version 1.0.0

  • Initial release

统计信息

  • 总下载量: 1.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: CSS

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-06-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固