Git Product home page Git Product logo

laravel-mix-i18n's Introduction

Laravel Mix i18n

npm npm

Integrate Laravel Mix with vue-i18n and its official Webpack loader + extract localisable strings from all around your project code.

Getting started

yarn add -D laravel-mix-i18n
# or
npm i --dev laravel-mix-i18n

And add in your webpack.mix.js:

const mix = require('laravel-mix')
require('laravel-mix-i18n')

// Rest of your mix tasks here...

mix.i18n('resources/views', 'resources/lang', {
    loader: true,
    extractor: {
        extensions: '.blade.php'
    }
})

Check loader documentation here.

Advanced usage

Command line

You can also use this from your terminal just type:

./node_modules/.bin/i18n-extractor run es,en,fr,ch,jp

For more help just run it with --help or check the options below for more reference.

Options

Note: These are the options available for the extractor both in CLI, and webpack through extractor key except path and output.

Name Type Available Default
path string CLI resources/js
output string CLI resources/lang
extensions string CLI & Webpack ts,tsx,js,jsx,vue,blade.php
match RegExp | string CLI & Webpack (t|trans|__)\\([\\\'"`]([a-zA-Z0-9: ]+)[\\\'"`]\\)
locales string CLI & Webpack Required
loader boolean Webpack false
indentation string | number CLI & Webpack 2

License

This package is open-sourced software licensed under the MIT license.

laravel-mix-i18n's People

Contributors

d8vjork avatar

Watchers

 avatar

laravel-mix-i18n's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.