-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from benaja/main
Translation Strings as Keys support and adding file name in key option
- Loading branch information
Showing
27 changed files
with
781 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
database/migrations/add_is_root_to_translation_files_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::table('ltu_translation_files', function (Blueprint $table) { | ||
$table->boolean('is_root')->default(false)->after('extension'); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('ltu_translation_files', function (Blueprint $table) { | ||
$table->dropColumn('is_root'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use Brick\VarExporter\VarExporter; | ||
use Illuminate\Support\Facades\File; | ||
use Illuminate\Support\Str; | ||
|
||
function createDirectoryIfNotExits($path): void | ||
{ | ||
// check if $path is a filename or a directory | ||
if (Str::contains($path, '.')) { | ||
$path = dirname($path); | ||
} | ||
|
||
if (! File::exists($path)) { | ||
File::makeDirectory($path, 0755, true); | ||
} | ||
} | ||
|
||
function createPhpLanguageFile($path, array $content): void | ||
{ | ||
$path = lang_path($path); | ||
|
||
createDirectoryIfNotExits($path); | ||
|
||
File::put($path, "<?php\n\nreturn ".VarExporter::export($content, VarExporter::TRAILING_COMMA_IN_ARRAY).';'.PHP_EOL); | ||
} | ||
|
||
function createJsonLanguageFile($path, array $content): void | ||
{ | ||
$path = lang_path($path); | ||
|
||
createDirectoryIfNotExits($path); | ||
|
||
File::put($path, json_encode($content, JSON_PRETTY_PRINT)); | ||
} |
Oops, something went wrong.