Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feature multi language app & rebuild assets #112

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.vscode
.env
.phpunit.result.cache
build
Expand Down
12 changes: 12 additions & 0 deletions config/translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
*/
'path' => env('TRANSLATIONS_PATH', 'translations'),

/*
|--------------------------------------------------------------------------
| Laravel Translations Localization
|--------------------------------------------------------------------------
|
| The Laravel Translations determines the default locale that will be used
| This option can be set to any locale for which you plan to have translation strings.
|
*/

'locale' => env('TRANSLATIONS_LOCALE', 'en'),

/*
|--------------------------------------------------------------------------
| Laravel Translations route middleware
Expand Down
5 changes: 4 additions & 1 deletion database/factories/ContributorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Outhebox\TranslationsUI\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Outhebox\TranslationsUI\Enums\LocaleEnum;
use Outhebox\TranslationsUI\Enums\RoleEnum;
use Outhebox\TranslationsUI\Models\Contributor;

class ContributorFactory extends Factory
Expand All @@ -14,8 +16,9 @@ public function definition(): array
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'role' => $this->faker->randomElement(['admin', 'translator']),
'role' => $this->faker->randomElement(RoleEnum::cases()),
'password' => bcrypt('password'),
'lang' => $this->faker->randomElement(LocaleEnum::cases()),
'remember_token' => null,
];
}
Expand Down
4 changes: 2 additions & 2 deletions database/factories/LanguageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function definition(): array
{
return [
'rtl' => $this->faker->boolean(),
'code' => $this->faker->randomElement(['en', 'nl', 'fr', 'de', 'es', 'it', 'pt', 'ru', 'ja', 'zh']),
'name' => $this->faker->randomElement(['English', 'Dutch', 'French', 'German', 'Spanish', 'Italian', 'Portuguese', 'Russian', 'Japanese', 'Chinese']),
'code' => $this->faker->randomElement(['en', 'nl', 'fr', 'de', 'es', 'id', 'it', 'pt', 'ru', 'ja', 'zh']),
'name' => $this->faker->randomElement(['English', 'Dutch', 'French', 'German', 'Spanish', 'Indonesian', 'Italian', 'Portuguese', 'Russian', 'Japanese', 'Chinese']),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class() extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
28 changes: 28 additions & 0 deletions database/migrations/add_lang_to_constributors_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class() extends Migration
{
public function getConnection()
{
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
{
Schema::table('ltu_contributors', function (Blueprint $table) {
$table->string('lang')->default('en')->after('role');
});
}

public function down(): void
{
Schema::table('ltu_contributors', function (Blueprint $table) {
$table->dropIfExists('lang');
});
}
};
5 changes: 2 additions & 3 deletions database/migrations/create_contributors_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
5 changes: 2 additions & 3 deletions database/migrations/create_invites_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Enums\RoleEnum;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
5 changes: 2 additions & 3 deletions database/migrations/create_languages_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
5 changes: 2 additions & 3 deletions database/migrations/create_phrases_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Enums\StatusEnum;
use Outhebox\TranslationsUI\Facades\TranslationsUI;
use Outhebox\TranslationsUI\Models\Phrase;
use Outhebox\TranslationsUI\Models\Translation;
use Outhebox\TranslationsUI\Models\TranslationFile;
Expand All @@ -12,9 +13,7 @@
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
5 changes: 2 additions & 3 deletions database/migrations/create_translation_files_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
5 changes: 2 additions & 3 deletions database/migrations/create_translations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Outhebox\TranslationsUI\Facades\TranslationsUI;

return new class extends Migration
{
public function getConnection()
{
$connection = config('translations.database_connection');

return $connection ?? $this->connection;
return TranslationsUI::getConnection() ?? $this->connection;
}

public function up(): void
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"eslint-plugin-vue": "^9.20.1",
"floating-vue": "^2.0.0-beta.24",
"laravel-vite-plugin": "^0.8.1",
"laravel-vue-i18n": "^2.7.6",
"lodash": "^4.17.21",
"mitt": "^3.0.1",
"momentum-modal": "^0.2.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading