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

On this page you can find all versions of the php package barbosa89/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

Laravel vue-i18n generator

run-tests Latest Stable Version License

Laravel package that allows you to share your Laravel localizations with your VueJS front-end, using vue-i18n or vuex-i18n. Tested versions: Laravel >=6.x.

Laravel 9 notice!

The new version of the framework moved the language folder out of the resources folder, so you need to update the langPath in the config file:

You can also set the environment variable to assign the path.

Install the package

In your project:

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, <=8.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:

License

Under MIT


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

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
ext-mbstring Version *
illuminate/console Version ^6.0|^7.0|^8.0|^9.0
illuminate/support Version ^6.0|^7.0|^8.0|^9.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 barbosa89/laravel-vue-i18n-generator contains the following files

Loading the files please wait ....