forxer/generic-term-translations-for-laravel

A plugin for Laravel Lang that provides generic term translations for Laravel.
2,473 2
Install
composer require forxer/generic-term-translations-for-laravel
Latest Version:2.0.0
PHP:^8.4
License:MIT
Last Updated:Aug 26, 2026
Links: GitHub  ·  Packagist
Maintainer: forxer

Generic term translations for Laravel

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

Upgrading from 1.x? Read the upgrade guide first.

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

Requirements

  • PHP ^8.4
  • laravel-lang/publisher ^16.0

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 composer update
  2. Update the sources as needed in source/ files
  3. Run the console command php vendor/bin/lang sync
  4. Translate modifications in locales/{locale}/php.json
  5. Run composer glossary to regenerate GLOSSARY.md
  6. Run composer test to check key consistency across locales and that the glossary is up to date
  7. Run composer lint to format the code
  8. Commit changes

GLOSSARY.md is a generated file: it is built from source/ and locales/, and must never be edited by hand. composer test fails when it no longer matches them.

Related Packages

arcanedev/laravel-lang

Translations manager and checker for Laravel 5 based on 'caouecs/laravel4-lang'...

71,650 70
laravel-lang/lang

List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify,...

12,171,632 7,775