laravel-lang-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Laravel Lang Loader

Loads a Laravel translations file as a as JSON into JavaScipt libraries.

Install

npm install laravel-lang-loader

Usage

In your app.js (or app.ts) file add:

import LaravelTranslations from 'laravel-lang-loader!laravel-lang-loader';

where LaravelTranslation can be any variable name.

Configuration is provided by .json file, and it must be store in ./resource/lang with .lll.config.json name. Minimal requirement is at least one lang dir defined in dir key:

// lll.config.json

{
    "dir": [
        "./resources/lang",
        {
            "path": "./app/Modules/*/resources/lang",
            "namespaceFromPath": "./app/Modules/[:namespace]/resources/lang"
        }
    ],
    "php": true,
    "json": true
}
Options * dir - string or object with path to lang files. If object is given then should contain: * path (string) - path to lang directory * namespace (string) - constant namespace string for all file in directory * namespaceFromPath - definition of the namespace form file path. It should be marked with `[:namespace]` * php (boolean) - parse PHP files * json (boolean) - parse JSON files

Package Sidebar

Install

npm i laravel-lang-loader

Weekly Downloads

5

Version

1.0.4

License

MIT

Unpacked Size

36.8 kB

Total Files

29

Last publish

Collaborators

  • soitpl