在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):rmariuzzo/Laravel-JS-Localization开源软件地址(OpenSource Url):https://github.com/rmariuzzo/Laravel-JS-Localization开源编程语言(OpenSource Language):PHP 98.7%开源软件介绍(OpenSource Introduction):This package convert all your localization messages from your Laravel app to JavaScript with a small library to interact with those messages following a very similar syntax you are familiar with. Features
Installationcomposer require mariuzzo/laravel-js-localization In your Laravel app go to Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider::class UsageThe Generating JS messagesphp artisan lang:js Specifying a custom targetphp artisan lang:js public/assets/dist/lang.dist.js Compressing the JS filephp artisan lang:js -c Specifying a custom source folderphp artisan lang:js public/assets/dist/lang.dist.js -s themes/default/lang Output a JSON file instead.php artisan lang:js --json ConfigurationFirst, publish the default package's configuration file running: php artisan vendor:publish --provider="Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider" The configuration will be published to You may edit this file to define the messages you need in your Javascript code. Just edit the To make only <?php
return [
'messages' => [
'pagination',
'validation',
],
]; gulp (optional)UsingInstall var shell = require('gulp-shell');
gulp.task('langjs', shell.task('php artisan lang:js -c public/js/messages.js')); Laravel's elixir (optional)UsingBefore Elixir 4.0: elixir.extend('langjs', function(path) {
gulp.task('langjs', function() {
gulp.src('').pipe(shell('php artisan lang:js ' + (path || 'public/js/messages.js')));
});
return this.queueTask('langjs');
}); Elixir 4.0+: var Task = elixir.Task;
elixir.extend('langjs', function(path) {
new Task('langjs', function() {
gulp.src('').pipe(shell('php artisan lang:js ' + (path || 'public/js/messages.js')));
});
}); And use it like this: elixir(function(mix) {
mix.langjs();
}); Laravel's Mix with Laravel 5.4+ (optional)UsingAdd "webpack-shell-plugin" to package.json's "devDependencies" section. Add the following to webpack.mix.js: const WebpackShellPlugin = require('webpack-shell-plugin');
// Add shell command plugin configured to create JavaScript language file
mix.webpackConfig({
plugins:
[
new WebpackShellPlugin({onBuildStart:['php artisan lang:js --quiet'], onBuildEnd:[]})
]
}); DocumentationThis is a quick documentation regarding Lang.js (the thin JavaScript library included by |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论