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 Developer
Remote
Livesystems dooh AG
Senior Backend Engineer
Remote
64 Robots
Senior Laravel Developer
Atlanta, GA
Helium LLC
Full-Stack Developer (JS - Vue.js, PHP - Laravel)
US Remote / Telecommute
TTEC Digital
Backend Engineer
Brooklyn, NY
Stationhead
Back-End Developer
Orlando, FL
Christ for all Nations
Senior Software Developer
Nashville, TN
Bernard Health