forxer/generic-term-translations-for-laravel 问题修复 & 功能扩展

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

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

forxer/generic-term-translations-for-laravel

最新稳定版本:1.9.1

Composer 安装命令:

composer require forxer/generic-term-translations-for-laravel

包简介

A plugin for Laravel Lang that provides generic term translations for Laravel.

README 文档

README

A plugin for Laravel Lang that provides generic term translations for Laravel project.

Consult the glossary to see all the terms available for translation.

Installation

Require the project using Composer:

composer require forxer/generic-term-translations-for-laravel --dev

Then use the locales publisher of Laravel Lang to add/update/reset or remove translations of this package:

Usage

This package provides translations for terms regularly used in projects.

You will find all the terms provided by this package in the glossary.

Terms are categorized into different sections by source files. For example there is an action.php source file that defines the add_something key, you can use it like this:

// "en" locale
trans('action.add_something', [
    'something' => 'a post',
]);

// return: "add a post"

// "fr" locale
trans('action.add_something', [
    'something' => 'un article',
]);

// return: "ajouter un article"

Be careful to escape the data that you do not control:

trans('action.delete_something', [
    'something' => e($post->title),
]);

Feminine and masculine gender

Some languages distinguish between feminine and masculine genders, for the same term the feminine key will then be suffixed by _fem. For example:

In English we use "all", while in French we use "toutes" in the feminine and "tous" in the masculine (see it on Google Translate).

// "en" locale
trans('misc.all'); // return: "all"

trans('misc.all_fem'); // return: "all"

// "fr" locale
trans('misc.all'); // return: "tous"

trans('misc.all_fem'); // return: "toutes"

Development steps

  1. From the package directory, run php composer update
  2. Update the sources as needed in src/source files
  3. Run the console command php vendor/bin/lang sync
  4. Translate modifications in src/locales/{locale}/php.json
  5. Run php generate-glossary
  6. Commit changes

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-30