From e623dab20c23b3f68100f6d1f1e159ff731ecba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linhart=20Tom=C3=A1=C5=A1?= Date: Sat, 14 Mar 2020 12:18:23 +0100 Subject: [PATCH] Added new configuration parameter 'outputExtension' for possibility change output file extension when generates multiple files. --- src/Generator.php | 2 +- src/config/vue-i18n-generator.php | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Generator.php b/src/Generator.php index 8055cb2..50689a1 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -158,7 +158,7 @@ public function generateMultiple($path, $format = 'es6', $multiLocales = false) } } foreach ($this->filesToCreate as $fileName => $data) { - $fileToCreate = $jsPath . $fileName . '.js'; + $fileToCreate = $jsPath . $fileName . '.' . $this->config['outputExtension']; $createdFiles .= $fileToCreate . PHP_EOL; $jsonLocales = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; if (json_last_error() !== JSON_ERROR_NONE) { diff --git a/src/config/vue-i18n-generator.php b/src/config/vue-i18n-generator.php index e6616e5..cc1543b 100644 --- a/src/config/vue-i18n-generator.php +++ b/src/config/vue-i18n-generator.php @@ -48,16 +48,36 @@ /* |-------------------------------------------------------------------------- - | Output file + | Single output file |-------------------------------------------------------------------------- | | The javascript path where I will place the generated file. | Note: the path will be prepended to point to the App directory. | */ - 'jsPath' => '/resources/js/langs/', 'jsFile' => '/resources/js/vue-i18n-locales.generated.js', + /* + |-------------------------------------------------------------------------- + | Multiple files output path + |-------------------------------------------------------------------------- + | + | The javascript path where I will place the generated files. + | Note: the path will be prepended to point to the App directory. + | + */ + 'jsPath' => '/resources/js/langs/', + + /* + |-------------------------------------------------------------------------- + | Multiple files output extension + |-------------------------------------------------------------------------- + | + | Output file extension for generate multiple files. + | + */ + 'outputExtension' => 'js', + /* |-------------------------------------------------------------------------- | i18n library