Localization Helper - Package for convenient work with Laravel's localization features and fast language files generation

Overview

Awes.io logo

Localization Helper

Package for convenient work with Laravel's localization features and fast language files generation.

Coverage report Last version Build status Downloads License CDN Ready laravel Last commit Analytics Hosted by Package Kit Patreon

Localization Helper

Installation

Via Composer

$ composer require awes-io/localization-helper

In Laravel 5.5+, service provider and facade will be automatically registered. For older versions, follow the steps below:

Register service provider in config/app.php:

'providers' => [
// [...]
        AwesIO\LocalizationHelper\LocalizationHelperServiceProvider::class,
],

You may also register LaravelLocalization facade:

'aliases' => [
// [...]
        'LocalizationHelper' => AwesIO\LocalizationHelper\Facades\LocalizationHelper::class,
],

Config

Config Files

In order to edit default configuration you may execute:

php artisan vendor:publish --provider="AwesIO\LocalizationHelper\LocalizationHelperServiceProvider"

After that, config/localizationhelper.php will be created.

Usage

Localization Helper

Package registers global helper function _p($file_key, $default, $placeholders):

_p('auth.login', 'Login'); // "Login"

It will create new localization file auth.php (if it doesn't exist) and write second parameter as language string under login key:

"Login" ];">
return [
    "login" => "Login"
];

On second call with same file/key _p('auth.login'), localization string will be returned, file will remain untouched.

Placeholders are also supported:

_p(
    'mail.invitation', 
    'You’re invited to join :company company workspace', 
    ['company' => 'Awesio']
);

If key is returned, it means that string already exists in localization file and you are trying to add new one using its value as an array.

"Test string" ]; _p('file.test.new', 'Test string'); // will return "file.test.new" _p('file.test_2.new', 'Test string'); // will return "Test string" // and modify localization file: return [ "test" => "Test string", "test_2" => [ "new" => "Test string" ] ];">
// in localization file.php
return [
    "test" => "Test string"
];

_p('file.test.new', 'Test string'); // will return "file.test.new"

_p('file.test_2.new', 'Test string'); // will return "Test string"

// and modify localization file:
return [
    "test" => "Test string",
    "test_2" => [
        "new" => "Test string"
    ]
];

Change log

Please see the changelog for more information on what has changed recently.

Testing

The coverage of the package is Coverage report.

You can run the tests with:

composer test

Contributing

Please see contributing.md for details and a todolist.

Credits

License

MIT

You might also like...
Seo Manager Package for Laravel ( with Localization )
Seo Manager Package for Laravel ( with Localization )

Seo Manager Package for Laravel ( with Localization ) lionix/seo-manager package will provide you an interface from where you can manage all your page

Searches for multilingual phrases in Laravel project and automatically generates language files for you.
Searches for multilingual phrases in Laravel project and automatically generates language files for you.

Laravel Lang Generator Searches for multilingual phrases in a Laravel project and automatically generates language files for you. You can search for n

A Laravel Larex plugin to import/export localization strings from/to Crowdin
A Laravel Larex plugin to import/export localization strings from/to Crowdin

Laravel Larex: Crowdin Plugin A Laravel Larex plugin to import/export localization strings from/to Crowdin πŸ“‹ Requirements PHP 7.4 | 8.0 Laravel β‰₯ 7 L

Easy Localization for Laravel
Easy Localization for Laravel

Query String Localization Package for Laravel Use this package to localize your laravel application via query strings easily. Features: Localization b

A laravel package to generate class files from stub files.

Laravel Stub Generator A php laravel package to generate useable php files from given stub files . Installation Require the package using composer: co

A Laravel package that allows you to use multiple
A Laravel package that allows you to use multiple ".env" files in a precedent manner. Use ".env" files per domain (multi-tentant)!

Laravel Multi ENVs Use multiple .envs files and have a chain of precedence for the environment variables in these different .envs files. Use the .env

GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn
GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn

GeoLocation in PHP (API) 😍 😍 😍 This package helps you to know a lot of information about the current user by his ip address 😍 😍 😍 This package h

Laravel package to work with geospatial data types and functions.

Laravel Spatial Laravel package to work with geospatial data types and functions. For now it supports only MySql Spatial Data Types and Functions. Sup

Caches responses as static files on disk for lightning fast page loads.

Laravel Page Cache This package allows you to easily cache responses as static files on disk for lightning fast page loads. Introduction Installation

Releases(v1.1.1)
Owner
Galymzhan Begimov
Galymzhan Begimov
Composer package which adds support for HTML5 elements using Laravels Form interface (e.g. Form::date())

Laravel HTML 5 Inputs Composer package which adds support for HTML5 elements by extending Laravel's Form interface (e.g. Form::date()) Adds support fo

Small Dog Studios 11 Oct 13, 2020
A package to flash multiple messages using Laravels default session message flashing system

Flash multiple advanced messages with both text, messages and links An opinionated solution for flashing multiple advanced messages from the backend a

Bilfeldt 6 Jan 18, 2022
Adds a way to write php and run it directly in Laravels' Artisan Tinker.

Adds a way to write php in PhpStorm/IDEA and run it directly as if through laravel artisan tinker - allowing you to quickly run a piece of code with a

Robbin 120 Jan 2, 2023
This package provides convenient methods for making token code, sending and verifying mobile phone verification requests.

Laravel Mobile Verification Introduction Many web applications require users to verify their mobile phone numbers before using the application. Rather

M.Fouladgar 347 Dec 25, 2022
Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Jameson Lopp 28 Dec 19, 2022
A helper package to flash a bootstrap alert to the browser via a Facade or a helper function.

Alert Box (Laravel) A helper package to flash a bootstrap alert to the browser via a Facade or a helper function. <div class="alert alert-info fade in

Ben-Piet O'Callaghan 17 Dec 30, 2022
Cache-purge-helper - Additional instances where nginx-helper and lscache plugin should be purged.

cache-purge-helper Additional instances where nginx-helper and lscache plugin should be purged. Install Extract the zip file. Upload them to /wp-conte

Jordan 10 Oct 5, 2022
Convenient tool for speeding up the intern/officer review process.

icpc-app-screen Convenient tool for speeding up the intern/officer applicant review process. Eliminates the pain from reading application responses of

null 1 Oct 30, 2021
A convenient way to initialize your application

A convenient way to initialize your application. Introduction We all know, that every application should contain readme file and Installation section

Mad Web 684 Dec 16, 2022
Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Indatus 197 Dec 30, 2022