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

Full Stack Developer (Laravel/Vue.JS)
London, UK or Remote (UK only)
hullo Ltd
Senior Web Developer
San Diego, CA
Platform Science
Laravel Developer
San Jose, CA
X3 Builders
Lead Front End Developer
Remote
continued
Full-Stack Laravel Developer
Cologne
Revive Interior
Intermediate PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
Remote
continued
Senior PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
Remote
continued