Laravel Translations Loader

Laravel Translations Loader

Laravel Translations Loader is a webpack loader to import your Laravel translation files (PHP or JSON) by Luís Dalmolin and Kirschbaum Development Group.

You install this package as an NPM dependency with NPM or Yarn:

npm install @kirschbaum-development/laravel-translations-loader --save-dev

# Or...

yarn add @kirschbaum-development/laravel-translations-loader --dev

Kirschbaum also has a demo project you can reference to see how it works. Here’s an example of how it works from the demo project’s ExampleComponent component:

<template>
    <div class="container">
        <p><strong>Translation for "auth.php" (PHP file):</strong><br>
        {{ $t('auth.failed') }}</p>

        <p><strong>Translation for "Hello World" (JSON file):</strong><br>
        {{ $t('Hello World') }}</p>
    </div>
</template>

And here’s an example of how you might use this package with vue-i18n:

import languageBundle from '@kirschbaum-development/laravel-translations-loader!@kirschbaum-development/laravel-translations-loader';
import VueI18n from 'vue-i18n';
Vue.use(VueI18n);

const i18n = new VueI18n({
    locale: window.Locale,
    messages: languageBundle,
})

To learn more about this project, installation, and usage instructions, check out the project’s GitHub repo: laravel-translations-loader. The readme also has useful packages you can use with the Laravel Translations Loader project if you’re using React, Vue, and i18next in your projects with this package.


Filed in: News / Translations


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Web Application Developer
Independence, Ohio or Remote - US Based Only
Hurricane Labs
Graduate / Junior PHP Developer
Leamington Spa, Warwick
Synchro
Laravel Developer
Remote - US only
Pleio
Web Application Developer
Cleveland, OH
PS Lifestyle
Full-Stack Developer
Tampa, FL / Remote
Nu Image Medical
PHP Developer
Remote
X-Team
Full-Stack Developer
Sioux Falls, SD or Remote
Electric Pulp