Download the PHP package slayerbleast/laravel-vue-i18n-generator without Composer

On this page you can find all versions of the php package slayerbleast/laravel-vue-i18n-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-vue-i18n-generator

About

Build Status

Laravel 5 package that allows you to share your Laravel localizations with your vue front-end, using vue-i18n or vuex-i18n.

Laravel 5.7 notice!

Configuration paths have changed in Laravel 5.7, in order for this package to function properly you need to configure correct paths for jsPath and jsFile in your config\vue-i18n-generator.php.

Install the package

In your project:

For Laravel 5.4 and below:

For older versions of the framework:

Register the service provider in

Next, publish the package default config:

Using vue-i18n

Next, you need to install one out of two supported VueJs i18n libraries. We support vue-i18n as default library. Beside that we also support vuex-i18n.

When you go with the default option, you only need to install the library through your favorite package manager.

vue-i18n

Then generate the include file with

Assuming you are using a recent version of vue-i18n (>=6.x), adjust your vue app with something like:

For older vue-i18n (5.x), the initialization looks something like:

Using vuex-i18n

vuex-i18n

Next, open config/vue-i18n-generator.php and do the following changes:

Then generate the include file with

Assuming you are using a recent version of vuex-i18n, adjust your vue app with something like:

Output Formats

You can specify the output formats from es6, umd, or json with the --format option. (defaults to es6)

Use case example for UMD module

An UMD module can be imported into the browser, build system, node and etc.

Now you can include the generated script in the browser as a normal script and reference it with window.vuei18nLocales.

You can still require/import it in your build system as stated above.

One advantage of doing things like this is you are not obligated to do a build of your javascript each time a the translation files get changed/saved. A good example is if you have a backend that can read and write to your translation files (like Backpack). You can listen to a save event there and call vue-i18n-generator.

Generating Multiple Files

Sometimes you may want to generate multiple files as you want to make use of lazy loading. As such, you can specify that the generator produces multiple files within the destination directory.

There are two options:

  1. One file per laravel module language file using switch
  2. One file per locale using switch

Parameters

The generator adjusts the strings in order to work with vue-i18n's named formatting, so you can reuse your Laravel translations with parameters.

resource/lang/message.php:

in vue-i18n-locales.generated.js:

Blade template:

Vue template:

Notices

The more sophisticated pluralization localization as described here is not supported since neither vue-i18n or vuex-i18n support this.

License

Under MIT


All versions of laravel-vue-i18n-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
ext-json Version *
ext-mbstring Version *
illuminate/console Version ~5.1.0|~5.2.0|~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0|~7.0|~8.0
illuminate/support Version ~5.1.0|~5.2.0|~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0|~7.0|~8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package slayerbleast/laravel-vue-i18n-generator contains the following files

Loading the files please wait ....