-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update file system to be json files remove translation-loader
- Loading branch information
Showing
32 changed files
with
255 additions
and
259 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
Binary file not shown.
51 changes: 0 additions & 51 deletions
51
Database/Migrations/2022_01_25_010712_create_language_lines_table.php
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...se/Seeders/TranslationsDatabaseSeeder.php → ...eeders/TranslationsjsonDatabaseSeeder.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
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 |
---|---|---|
@@ -1,59 +1,24 @@ | ||
<?php | ||
|
||
namespace Modules\Translations\Entities; | ||
namespace Modules\Translations\Entities; | ||
|
||
use Spatie\TranslationLoader\LanguageLine; | ||
use Illuminate\Database\Eloquent\SoftDeletes; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Modules\Translations\Services\SaveScan; | ||
use Sushi\Sushi; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
|
||
|
||
class Translation extends LanguageLine | ||
class Translation extends Model | ||
{ | ||
use HasFactory; | ||
use SoftDeletes; | ||
|
||
public $translatable = ['text']; | ||
|
||
/** @var array */ | ||
public $guarded = ['id']; | ||
use Sushi; | ||
|
||
/** @var array */ | ||
protected $casts = ['text' => 'array']; | ||
protected ?array $rows = []; | ||
|
||
protected $table = "language_lines"; | ||
|
||
protected $fillable = [ | ||
"group", | ||
"key", | ||
"text" | ||
]; | ||
|
||
|
||
public static function getTranslatableLocales(): array | ||
public function getRows() | ||
{ | ||
return config('filament-translations.locals'); | ||
} | ||
|
||
public function getTranslation(string $locale, string $group = null): string | ||
{ | ||
if ($group === '*' && !isset($this->text[$locale])) { | ||
$fallback = config('app.fallback_locale'); | ||
|
||
return $this->text[$fallback] ?? $this->key; | ||
} | ||
return $this->text[$locale] ?? ''; | ||
} | ||
|
||
public function setTranslation(string $locale, string $value): self | ||
{ | ||
$this->text = array_merge($this->text ?? [], [$locale => $value]); | ||
|
||
return $this; | ||
return (new SaveScan())->getKeys(); | ||
} | ||
|
||
protected function getTranslatedLocales(): array | ||
protected function sushiShouldCache() | ||
{ | ||
return array_keys($this->text); | ||
return false; | ||
} | ||
} |
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
Empty file.
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,79 @@ | ||
<?php | ||
|
||
namespace Modules\Translationsjson\Http\Controllers; | ||
|
||
use Illuminate\Contracts\Support\Renderable; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Routing\Controller; | ||
|
||
class TranslationsjsonController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* @return Renderable | ||
*/ | ||
public function index() | ||
{ | ||
return view('translationsjson::index'); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* @return Renderable | ||
*/ | ||
public function create() | ||
{ | ||
return view('translationsjson::create'); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* @param Request $request | ||
* @return Renderable | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the specified resource. | ||
* @param int $id | ||
* @return Renderable | ||
*/ | ||
public function show($id) | ||
{ | ||
return view('translationsjson::show'); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* @param int $id | ||
* @return Renderable | ||
*/ | ||
public function edit($id) | ||
{ | ||
return view('translationsjson::edit'); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* @param Request $request | ||
* @param int $id | ||
* @return Renderable | ||
*/ | ||
public function update(Request $request, $id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* @param int $id | ||
* @return Renderable | ||
*/ | ||
public function destroy($id) | ||
{ | ||
// | ||
} | ||
} |
Empty file.
Empty file.
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
Oops, something went wrong.