🎌 Laravel Localization Helper :: Easily add translation variables from Blade templates.

Last update: Jan 15, 2022

LocalizationHelper

Coverage report Build status Composer Ready Downloads Last version

Package for convenient work with Laravel's localization features and fast language files generation. Take a look at contributing.md to see a to do list.

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

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:

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.

// 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

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

MIT

GitHub

https://github.com/awes-io/localization-helper
You might also like...

The Translation component provides tools to internationalize your application.

Translation Component The Translation component provides tools to internationalize your application. Getting Started $ composer require symfony/transl

May 25, 2022

Filament Translations - Manage your translation with DB and cache

Filament Translations - Manage your translation with DB and cache

Filament Translations Manage your translation with DB and cache, you can scan your languages tags like trans(), __(), and get the string inside and tr

Apr 22, 2022

List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Cashier and Laravel Nova.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

May 28, 2022

75 languages support for Laravel 5 application based on Laravel-Lang/lang.

Laravel-lang 75 languages support for Laravel 5 application based on Laravel-Lang/lang. Features Laravel 5+ && Lumen support. Translations Publisher.

May 19, 2022

[Deprecated] A Laravel package for multilingual models

[Deprecated] A Laravel package for multilingual models

This package has been deprecated. But worry not. You can use Astrotomic/laravel-translatable. Laravel-Translatable If you want to store translations o

Apr 20, 2022

Easy multilingual urls and redirection support for the Laravel framework

Linguist - Multilingual urls and redirects for Laravel This package provides an easy multilingual urls and redirection support for the Laravel framewo

Feb 13, 2022

Package to manage Laravel translations locally

Package to manage Laravel translations locally

Translation Manager For Laravel Easy to use package that helps you with the translation of your Laravel application locally. Features βœ… Check all loca

Jan 8, 2022

Support multiple language resources for Laravel

Laratrans Support multiple language resources for Laravel. Docs Installation composer require lechihuy/laratrans After you install the package success

Dec 21, 2021

Generates a vue-i18n compatible include file from your Laravel translations

This is fork of martinlindhe/laravel-vue-i18n-generator to give Laravel 8+ support for this excellent package.

Nov 11, 2021
Weblate translation provider for Symfony Translation.

Weblate Translation Provider This bundle provides a Weblate integration for Symfony Translation. Installation composer require m2mtech/weblate-transla

May 6, 2022
Easy localization for Laravel

Laravel Localization Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes. The package offers the following

May 26, 2022
A self-hosting localization tool

Localiser A self-hosting localization tool. Requirements PHP ^7.3 Usage Fetch cached locales GET

Mar 10, 2022
Better translation management for Laravel

Better localization management for Laravel Introduction Keeping a project's translations properly updated is cumbersome. Usually translators do not ha

Apr 14, 2022
Laravel translation made __('simple').
Laravel translation made __('simple').

Translation.io client for Laravel 5.5+/6/7/8 Add this package to localize your Laravel application. Use the official Laravel syntax (with PHP or JSON

May 20, 2022
Manage Laravel translation files
Manage Laravel translation files

Laravel 5 Translation Manager For Laravel 4, please use the 0.1 branch! This is a package to manage Laravel translation files. It does not replace the

May 19, 2022
A Gui To Manage Laravel Translation Files
A Gui To Manage Laravel Translation Files

Lingo A file based translation manager, which unlike other Lang managers don't need a database connection to handle the translation. Installation comp

Apr 1, 2022
A GUI for managing JSON translation files in your laravel projects.
A GUI for managing JSON translation files in your laravel projects.

Laravel Language Manager Langman is a GUI for managing your JSON language files in a Laravel project. Installation Begin by installing the package thr

May 19, 2022
[virion] Language management library for automatic translation
[virion] Language management library for automatic translation

libtranslator :: library for automatic translation βœ”οΈ Multilingual support for plugin messages βœ”οΈ Translation language is set according to the player

Feb 15, 2022
Internationalization tools, particularly message translation.

Aura.Intl The Aura.Intl package provides internationalization (I18N) tools, specifically package-oriented per-locale message translation. Installation

Apr 1, 2022