JSPM

laravel-lang-loader

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q39233F
  • License MIT

Loader for parse and load Laravel lang files into JS translations libraries

Package Exports

  • laravel-lang-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (laravel-lang-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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