dusanbre/laravel-tolgee 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dusanbre/laravel-tolgee

最新稳定版本:1.1.0

Composer 安装命令:

composer require dusanbre/laravel-tolgee

包简介

Help with Laravel integration of Tolgee service

README 文档

README

Latest Version on Packagist Total Downloads

This package provides integration with Tolgee service with Laravel apps.

Installation

You can install the package via composer:

composer require dusanbre/laravel-tolgee

You can publish the config file with:

php artisan vendor:publish --tag="laravel-tolgee-config"

This is the contents of the published config file:

return [ /*  * Specify the path to your language files  * Default is 'lang' it can be set to 'resources/lang'  */ 'lang_path' => env('TOLGEE_LANG_PATH', 'lang'), /*  * Specify a language files subfolder, in order to filter specific language files.Please be aware that this applies to subfolders within your base local folders.  * So if you have folder structure like `lang/en/messages/...`, you can set this env variable to `messages` and package will use only files from messages folder.  */ 'lang_subfolder' => env('TOLGEE_LANG_SUBFOLDER'), /*  * Host to you Tolgee service instance  * Please note that if you are using Sail for local development, service need to be in the same docker network  * and you will need to set host in the format of 'http://{docker_tolgee_service_name}:{docker_tolgee_service_port}'  */ 'host' => env('TOLGEE_HOST', 'https://app.tolgee.io'), /**  * Project ID of your Tolgee service.  */ 'project_id' => env('TOLGEE_PROJECT_ID'), /**  * Valid api key from Tolgee service for the given project.  * Api key needs to have all permissions to manage project.  */ 'api_key' => env('TOLGEE_API_KEY'), /**  * Base locale of the project.  * Please note that the locale you set here should match the base language in your project.  */ 'locale' => env('TOLGEE_LOCALE', 'en'), /**  * Override base locale translations files.  */ 'override' => env('TOLGEE_OVERRIDE', false), /**  * Accepted translation states. Check Tolgee documentation for available states.  * Ex: REVIEWED,DISABLED,UNTRANSLATED,TRANSLATED  */ 'accepted_states' => explode(",", env('TOLGEE_ACCEPTED_STATES', 'REVIEWED')), ];

Usage

Package provides several Artisan commands to work with you translations in Tolgee.

  1. Import keys from your local files into Tolgee service
php artisan tolgee:keys:sync --with-vendors
  1. Delete all keys from Tolgee service
php artisan tolgee:keys:flush
  1. Import translations from Tolgee service into your local files
php artisan tolgee:translations:sync

You will need to have Tolgee instance set up in your config file.

Configuration

If you want to use this locally in your project you can run it on the docker container:

  1. Add service in your docker-compose.yml
... tolgee: image: tolgee/tolgee volumes: - sail-tolgee:/data - ./tolgee.config.yaml:/config.yaml ports: - '25432:25432' - '9090:8080' environment: spring.config.additional-location: file:///config.yaml networks: - sail ... volumes: ... sail-tolgee: driver: local 
  1. Add config tolgee.config.yaml in root of you project
tolgee: authentication: enabled: true initial-password: admin initial-username: admin jwt-secret: <jwt-secret> // Random string machine-translation: google: api-key: <google-translations-api-key> // If you want to use google translation smtp: auth: false from: Tolgee <no-reply@nibblo.com> host: mailpit password: 'password' port: 1025 ssl-enabled: false username: user@company.com 

You can see more about configuration and setup on Tolgee docs

  1. Restart docker containers
  2. Publish laravel translation files php artisan lang:publish
  3. Edit local translation files
  4. Use package commands to sync it with Tolgee

NOTE

You should be able to access Tolgee service on http://localhost:9090
When you setup is dockerized, you will need to set TOLGEE_HOST for docker internal network. In this case that would be http://tolgee:8080

Limitations

All operations are constrained to one project.

This will be fixed/implemented in the future.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固