Giter Site home page Giter Site logo

forxer / generic-term-translations-for-laravel Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 69 KB

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

License: MIT License

PHP 100.00%
laraval translations languages laravel-lang

generic-term-translations-for-laravel's Introduction

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.