feat: Add multi-language support (i18n)

Languages supported (8):
- English (en)
- 日本語 (ja)
- Deutsch (de)
- Français (fr)
- Español (es)
- 简体中文 (zh-CN)
- 繁體中文 (zh-TW)
- 한국어 (ko)

Changes:
- Add locale column to users table
- Add SetLocale middleware for automatic locale detection
- Add LocaleController for language switching
- Create language files with translations for all UI elements
- Add language selector to user profile page
- Update all Blade views to use translation strings
This commit is contained in:
2025-11-29 12:00:09 +09:00
parent ecfa21d56c
commit cdf0bf4bad
25 changed files with 1183 additions and 84 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers;
use App\Http\Middleware\SetLocale;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class LocaleController extends Controller
{
/**
* Update the user's locale preference.
*/
public function update(Request $request)
{
$validated = $request->validate([
'locale' => ['required', 'string', 'in:' . implode(',', array_keys(SetLocale::SUPPORTED_LOCALES))],
]);
$locale = $validated['locale'];
// Save to user record
Auth::user()->update(['locale' => $locale]);
// Also save to session for immediate effect
$request->session()->put('locale', $locale);
return redirect()->route('profile.edit')->with('success', __('messages.settings.language_updated'));
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class SetLocale
{
/**
* Supported locales
*/
public const SUPPORTED_LOCALES = [
'en' => 'English',
'ja' => '日本語',
'de' => 'Deutsch',
'fr' => 'Français',
'es' => 'Español',
'zh-CN' => '简体中文',
'zh-TW' => '繁體中文',
'ko' => '한국어',
];
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$locale = config('app.locale', 'en');
// Check authenticated user's preference
if (Auth::check() && Auth::user()->locale) {
$locale = Auth::user()->locale;
}
// Check session (for immediate effect after changing)
elseif ($request->session()->has('locale')) {
$locale = $request->session()->get('locale');
}
// Validate locale
if (!array_key_exists($locale, self::SUPPORTED_LOCALES)) {
$locale = 'en';
}
App::setLocale($locale);
return $next($request);
}
}

View File

@@ -22,6 +22,7 @@ class User extends Authenticatable
'email', 'email',
'password', 'password',
'is_admin', 'is_admin',
'locale',
]; ];
/** /**

View File

@@ -14,6 +14,11 @@
$middleware->alias([ $middleware->alias([
'admin' => \App\Http\Middleware\AdminMiddleware::class, 'admin' => \App\Http\Middleware\AdminMiddleware::class,
]); ]);
// Add SetLocale middleware to web group
$middleware->web(append: [
\App\Http\Middleware\SetLocale::class,
]);
}) })
->withExceptions(function (Exceptions $exceptions): void { ->withExceptions(function (Exceptions $exceptions): void {
// //

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('locale', 10)->default('en')->after('is_admin');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('locale');
});
}
};

117
src/lang/de/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => 'Dashboard',
'knowledge_base' => 'Wissensdatenbank',
'profile' => 'Profil',
'user_management' => 'Benutzerverwaltung',
'logout' => 'Abmelden',
'login' => 'Anmelden',
'register' => 'Registrieren',
],
// Documents
'documents' => [
'title' => 'Dokumente',
'new_document' => 'Neues Dokument',
'edit_document' => 'Dokument bearbeiten',
'edit' => 'Bearbeiten',
'delete' => 'Löschen',
'save' => 'Speichern',
'cancel' => 'Abbrechen',
'created_by' => 'Erstellt von',
'updated' => 'Aktualisiert',
'path' => 'Pfad',
'last_modified' => 'Zuletzt geändert',
'no_documents' => 'Keine Dokumente gefunden',
'search_placeholder' => 'Dokumente suchen...',
'create_success' => 'Dokument erfolgreich erstellt!',
'update_success' => 'Dokument erfolgreich aktualisiert!',
'delete_success' => 'Dokument erfolgreich gelöscht!',
'delete_confirm' => 'Möchten Sie dieses Dokument wirklich löschen?',
'linked_references' => 'Verknüpfte Referenzen',
'title_label' => 'Titel',
'title_placeholder' => 'Dokumenttitel (z.B. Laravel/Livewire/Components)',
'title_hint' => 'Tipp: Verwenden Sie Schrägstriche (/) im Titel, um Dokumente automatisch in Ordnern zu organisieren',
'content_label' => 'Inhalt',
'content_placeholder' => 'Schreiben Sie hier Ihren Markdown...',
'saving' => 'Speichern...',
],
// Quick Switcher
'quick_switcher' => [
'title' => 'Schnellwechsel',
'placeholder' => 'Dokumente suchen...',
'no_results' => 'Keine Dokumente gefunden',
'navigate' => 'zum Navigieren',
'select' => 'zum Auswählen',
'close' => 'zum Schließen',
],
// Admin
'admin' => [
'user_management' => 'Benutzerverwaltung',
'new_user' => 'Neuer Benutzer',
'edit_user' => 'Benutzer bearbeiten',
'create_user' => 'Benutzer erstellen',
'users' => 'Benutzer',
'name' => 'Name',
'email' => 'E-Mail',
'password' => 'Passwort',
'password_confirmation' => 'Passwort bestätigen',
'password_hint' => 'Leer lassen, um das aktuelle Passwort beizubehalten.',
'role' => 'Rolle',
'admin' => 'Administrator',
'user' => 'Benutzer',
'grant_admin' => 'Administratorrechte gewähren',
'created_at' => 'Erstellt am',
'actions' => 'Aktionen',
'edit' => 'Bearbeiten',
'delete' => 'Löschen',
'no_users' => 'Keine Benutzer gefunden.',
'create_success' => 'Benutzer erfolgreich erstellt.',
'update_success' => 'Benutzer erfolgreich aktualisiert.',
'delete_success' => 'Benutzer erfolgreich gelöscht.',
'cannot_delete_self' => 'Sie können sich nicht selbst löschen.',
'self_admin_warning' => 'Das Entfernen Ihrer eigenen Administratorrechte sperrt Sie aus dem Admin-Bereich aus.',
],
// Settings
'settings' => [
'language' => 'Sprache',
'select_language' => 'Sprache auswählen',
'language_updated' => 'Sprache erfolgreich aktualisiert.',
],
// Common
'common' => [
'save' => 'Speichern',
'cancel' => 'Abbrechen',
'delete' => 'Löschen',
'edit' => 'Bearbeiten',
'create' => 'Erstellen',
'update' => 'Aktualisieren',
'back' => 'Zurück',
'confirm' => 'Bestätigen',
'yes' => 'Ja',
'no' => 'Nein',
'loading' => 'Laden...',
'error' => 'Fehler',
'success' => 'Erfolg',
],
// Auth
'auth' => [
'login' => 'Anmelden',
'register' => 'Registrieren',
'email' => 'E-Mail',
'password' => 'Passwort',
'remember_me' => 'Angemeldet bleiben',
'forgot_password' => 'Passwort vergessen?',
'confirm_password' => 'Passwort bestätigen',
'already_registered' => 'Bereits registriert?',
],
];

117
src/lang/en/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => 'Dashboard',
'knowledge_base' => 'Knowledge Base',
'profile' => 'Profile',
'user_management' => 'User Management',
'logout' => 'Log Out',
'login' => 'Login',
'register' => 'Register',
],
// Documents
'documents' => [
'title' => 'Documents',
'new_document' => 'New Document',
'edit_document' => 'Edit Document',
'edit' => 'Edit',
'delete' => 'Delete',
'save' => 'Save',
'cancel' => 'Cancel',
'created_by' => 'Created by',
'updated' => 'Updated',
'path' => 'Path',
'last_modified' => 'Last modified',
'no_documents' => 'No documents found',
'search_placeholder' => 'Search documents...',
'create_success' => 'Document created successfully!',
'update_success' => 'Document updated successfully!',
'delete_success' => 'Document deleted successfully!',
'delete_confirm' => 'Are you sure you want to delete this document?',
'linked_references' => 'Linked References',
'title_label' => 'Title',
'title_placeholder' => 'Document Title (use / for folders, e.g. Laravel/Livewire/Components)',
'title_hint' => 'Tip: Use slashes (/) in the title to organize documents into folders automatically',
'content_label' => 'Content',
'content_placeholder' => 'Write your markdown here...',
'saving' => 'Saving...',
],
// Quick Switcher
'quick_switcher' => [
'title' => 'Quick Switch',
'placeholder' => 'Search documents...',
'no_results' => 'No documents found',
'navigate' => 'to navigate',
'select' => 'to select',
'close' => 'to close',
],
// Admin
'admin' => [
'user_management' => 'User Management',
'new_user' => 'New User',
'edit_user' => 'Edit User',
'create_user' => 'Create User',
'users' => 'Users',
'name' => 'Name',
'email' => 'Email',
'password' => 'Password',
'password_confirmation' => 'Confirm Password',
'password_hint' => 'Leave blank to keep current password.',
'role' => 'Role',
'admin' => 'Administrator',
'user' => 'User',
'grant_admin' => 'Grant administrator privileges',
'created_at' => 'Created',
'actions' => 'Actions',
'edit' => 'Edit',
'delete' => 'Delete',
'no_users' => 'No users found.',
'create_success' => 'User created successfully.',
'update_success' => 'User updated successfully.',
'delete_success' => 'User deleted successfully.',
'cannot_delete_self' => 'You cannot delete yourself.',
'self_admin_warning' => 'Removing your own admin privileges will lock you out of the admin panel.',
],
// Settings
'settings' => [
'language' => 'Language',
'select_language' => 'Select Language',
'language_updated' => 'Language updated successfully.',
],
// Common
'common' => [
'save' => 'Save',
'cancel' => 'Cancel',
'delete' => 'Delete',
'edit' => 'Edit',
'create' => 'Create',
'update' => 'Update',
'back' => 'Back',
'confirm' => 'Confirm',
'yes' => 'Yes',
'no' => 'No',
'loading' => 'Loading...',
'error' => 'Error',
'success' => 'Success',
],
// Auth
'auth' => [
'login' => 'Login',
'register' => 'Register',
'email' => 'Email',
'password' => 'Password',
'remember_me' => 'Remember me',
'forgot_password' => 'Forgot your password?',
'confirm_password' => 'Confirm Password',
'already_registered' => 'Already registered?',
],
];

117
src/lang/es/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => 'Panel de control',
'knowledge_base' => 'Base de conocimientos',
'profile' => 'Perfil',
'user_management' => 'Gestión de usuarios',
'logout' => 'Cerrar sesión',
'login' => 'Iniciar sesión',
'register' => 'Registrarse',
],
// Documents
'documents' => [
'title' => 'Documentos',
'new_document' => 'Nuevo documento',
'edit_document' => 'Editar documento',
'edit' => 'Editar',
'delete' => 'Eliminar',
'save' => 'Guardar',
'cancel' => 'Cancelar',
'created_by' => 'Creado por',
'updated' => 'Actualizado',
'path' => 'Ruta',
'last_modified' => 'Última modificación',
'no_documents' => 'No se encontraron documentos',
'search_placeholder' => 'Buscar documentos...',
'create_success' => '¡Documento creado exitosamente!',
'update_success' => '¡Documento actualizado exitosamente!',
'delete_success' => '¡Documento eliminado exitosamente!',
'delete_confirm' => '¿Está seguro de que desea eliminar este documento?',
'linked_references' => 'Referencias vinculadas',
'title_label' => 'Título',
'title_placeholder' => 'Título del documento (ej: Laravel/Livewire/Components)',
'title_hint' => 'Consejo: Use barras (/) en el título para organizar documentos en carpetas automáticamente',
'content_label' => 'Contenido',
'content_placeholder' => 'Escriba su markdown aquí...',
'saving' => 'Guardando...',
],
// Quick Switcher
'quick_switcher' => [
'title' => 'Cambio rápido',
'placeholder' => 'Buscar documentos...',
'no_results' => 'No se encontraron documentos',
'navigate' => 'para navegar',
'select' => 'para seleccionar',
'close' => 'para cerrar',
],
// Admin
'admin' => [
'user_management' => 'Gestión de usuarios',
'new_user' => 'Nuevo usuario',
'edit_user' => 'Editar usuario',
'create_user' => 'Crear usuario',
'users' => 'Usuarios',
'name' => 'Nombre',
'email' => 'Correo electrónico',
'password' => 'Contraseña',
'password_confirmation' => 'Confirmar contraseña',
'password_hint' => 'Deje en blanco para mantener la contraseña actual.',
'role' => 'Rol',
'admin' => 'Administrador',
'user' => 'Usuario',
'grant_admin' => 'Otorgar privilegios de administrador',
'created_at' => 'Fecha de creación',
'actions' => 'Acciones',
'edit' => 'Editar',
'delete' => 'Eliminar',
'no_users' => 'No se encontraron usuarios.',
'create_success' => 'Usuario creado exitosamente.',
'update_success' => 'Usuario actualizado exitosamente.',
'delete_success' => 'Usuario eliminado exitosamente.',
'cannot_delete_self' => 'No puede eliminarse a sí mismo.',
'self_admin_warning' => 'Eliminar sus propios privilegios de administrador le impedirá acceder al panel de administración.',
],
// Settings
'settings' => [
'language' => 'Idioma',
'select_language' => 'Seleccionar idioma',
'language_updated' => 'Idioma actualizado exitosamente.',
],
// Common
'common' => [
'save' => 'Guardar',
'cancel' => 'Cancelar',
'delete' => 'Eliminar',
'edit' => 'Editar',
'create' => 'Crear',
'update' => 'Actualizar',
'back' => 'Volver',
'confirm' => 'Confirmar',
'yes' => 'Sí',
'no' => 'No',
'loading' => 'Cargando...',
'error' => 'Error',
'success' => 'Éxito',
],
// Auth
'auth' => [
'login' => 'Iniciar sesión',
'register' => 'Registrarse',
'email' => 'Correo electrónico',
'password' => 'Contraseña',
'remember_me' => 'Recordarme',
'forgot_password' => '¿Olvidó su contraseña?',
'confirm_password' => 'Confirmar contraseña',
'already_registered' => '¿Ya está registrado?',
],
];

117
src/lang/fr/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => 'Tableau de bord',
'knowledge_base' => 'Base de connaissances',
'profile' => 'Profil',
'user_management' => 'Gestion des utilisateurs',
'logout' => 'Déconnexion',
'login' => 'Connexion',
'register' => "S'inscrire",
],
// Documents
'documents' => [
'title' => 'Documents',
'new_document' => 'Nouveau document',
'edit_document' => 'Modifier le document',
'edit' => 'Modifier',
'delete' => 'Supprimer',
'save' => 'Enregistrer',
'cancel' => 'Annuler',
'created_by' => 'Créé par',
'updated' => 'Mis à jour',
'path' => 'Chemin',
'last_modified' => 'Dernière modification',
'no_documents' => 'Aucun document trouvé',
'search_placeholder' => 'Rechercher des documents...',
'create_success' => 'Document créé avec succès !',
'update_success' => 'Document mis à jour avec succès !',
'delete_success' => 'Document supprimé avec succès !',
'delete_confirm' => 'Êtes-vous sûr de vouloir supprimer ce document ?',
'linked_references' => 'Références liées',
'title_label' => 'Titre',
'title_placeholder' => 'Titre du document (ex: Laravel/Livewire/Components)',
'title_hint' => 'Astuce: Utilisez des barres obliques (/) dans le titre pour organiser automatiquement les documents en dossiers',
'content_label' => 'Contenu',
'content_placeholder' => 'Écrivez votre markdown ici...',
'saving' => 'Enregistrement...',
],
// Quick Switcher
'quick_switcher' => [
'title' => 'Changement rapide',
'placeholder' => 'Rechercher des documents...',
'no_results' => 'Aucun document trouvé',
'navigate' => 'pour naviguer',
'select' => 'pour sélectionner',
'close' => 'pour fermer',
],
// Admin
'admin' => [
'user_management' => 'Gestion des utilisateurs',
'new_user' => 'Nouvel utilisateur',
'edit_user' => "Modifier l'utilisateur",
'create_user' => 'Créer un utilisateur',
'users' => 'Utilisateurs',
'name' => 'Nom',
'email' => 'E-mail',
'password' => 'Mot de passe',
'password_confirmation' => 'Confirmer le mot de passe',
'password_hint' => 'Laissez vide pour conserver le mot de passe actuel.',
'role' => 'Rôle',
'admin' => 'Administrateur',
'user' => 'Utilisateur',
'grant_admin' => "Accorder les privilèges d'administrateur",
'created_at' => 'Créé le',
'actions' => 'Actions',
'edit' => 'Modifier',
'delete' => 'Supprimer',
'no_users' => 'Aucun utilisateur trouvé.',
'create_success' => 'Utilisateur créé avec succès.',
'update_success' => 'Utilisateur mis à jour avec succès.',
'delete_success' => 'Utilisateur supprimé avec succès.',
'cannot_delete_self' => 'Vous ne pouvez pas vous supprimer vous-même.',
'self_admin_warning' => "Supprimer vos propres privilèges d'administrateur vous empêchera d'accéder au panneau d'administration.",
],
// Settings
'settings' => [
'language' => 'Langue',
'select_language' => 'Sélectionner la langue',
'language_updated' => 'Langue mise à jour avec succès.',
],
// Common
'common' => [
'save' => 'Enregistrer',
'cancel' => 'Annuler',
'delete' => 'Supprimer',
'edit' => 'Modifier',
'create' => 'Créer',
'update' => 'Mettre à jour',
'back' => 'Retour',
'confirm' => 'Confirmer',
'yes' => 'Oui',
'no' => 'Non',
'loading' => 'Chargement...',
'error' => 'Erreur',
'success' => 'Succès',
],
// Auth
'auth' => [
'login' => 'Connexion',
'register' => "S'inscrire",
'email' => 'E-mail',
'password' => 'Mot de passe',
'remember_me' => 'Se souvenir de moi',
'forgot_password' => 'Mot de passe oublié ?',
'confirm_password' => 'Confirmer le mot de passe',
'already_registered' => 'Déjà inscrit ?',
],
];

117
src/lang/ja/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => 'ダッシュボード',
'knowledge_base' => 'ナレッジベース',
'profile' => 'プロフィール',
'user_management' => 'ユーザー管理',
'logout' => 'ログアウト',
'login' => 'ログイン',
'register' => '登録',
],
// Documents
'documents' => [
'title' => 'ドキュメント',
'new_document' => '新規ドキュメント',
'edit_document' => 'ドキュメント編集',
'edit' => '編集',
'delete' => '削除',
'save' => '保存',
'cancel' => 'キャンセル',
'created_by' => '作成者',
'updated' => '更新日',
'path' => 'パス',
'last_modified' => '最終更新',
'no_documents' => 'ドキュメントが見つかりません',
'search_placeholder' => 'ドキュメントを検索...',
'create_success' => 'ドキュメントを作成しました!',
'update_success' => 'ドキュメントを更新しました!',
'delete_success' => 'ドキュメントを削除しました!',
'delete_confirm' => 'このドキュメントを削除してもよろしいですか?',
'linked_references' => 'リンク元',
'title_label' => 'タイトル',
'title_placeholder' => 'ドキュメントタイトル(例: Laravel/Livewire/Components',
'title_hint' => 'ヒント: タイトルにスラッシュ(/)を含めると自動的にフォルダ構造が作成されます',
'content_label' => '本文',
'content_placeholder' => 'Markdownで記述してください...',
'saving' => '保存中...',
],
// Quick Switcher
'quick_switcher' => [
'title' => 'クイックスイッチ',
'placeholder' => 'ドキュメントを検索...',
'no_results' => 'ドキュメントが見つかりません',
'navigate' => 'で移動',
'select' => 'で選択',
'close' => 'で閉じる',
],
// Admin
'admin' => [
'user_management' => 'ユーザー管理',
'new_user' => '新規ユーザー',
'edit_user' => 'ユーザー編集',
'create_user' => 'ユーザー作成',
'users' => 'ユーザー',
'name' => '名前',
'email' => 'メールアドレス',
'password' => 'パスワード',
'password_confirmation' => 'パスワード(確認)',
'password_hint' => '変更しない場合は空欄のままにしてください。',
'role' => '権限',
'admin' => '管理者',
'user' => '一般ユーザー',
'grant_admin' => '管理者権限を付与する',
'created_at' => '登録日',
'actions' => '操作',
'edit' => '編集',
'delete' => '削除',
'no_users' => 'ユーザーが登録されていません。',
'create_success' => 'ユーザーを作成しました。',
'update_success' => 'ユーザー情報を更新しました。',
'delete_success' => 'ユーザーを削除しました。',
'cannot_delete_self' => '自分自身を削除することはできません。',
'self_admin_warning' => '自分自身の管理者権限を外すと、管理画面にアクセスできなくなります。',
],
// Settings
'settings' => [
'language' => '言語',
'select_language' => '言語を選択',
'language_updated' => '言語を変更しました。',
],
// Common
'common' => [
'save' => '保存',
'cancel' => 'キャンセル',
'delete' => '削除',
'edit' => '編集',
'create' => '作成',
'update' => '更新',
'back' => '戻る',
'confirm' => '確認',
'yes' => 'はい',
'no' => 'いいえ',
'loading' => '読み込み中...',
'error' => 'エラー',
'success' => '成功',
],
// Auth
'auth' => [
'login' => 'ログイン',
'register' => '登録',
'email' => 'メールアドレス',
'password' => 'パスワード',
'remember_me' => 'ログイン状態を保持',
'forgot_password' => 'パスワードをお忘れですか?',
'confirm_password' => 'パスワード(確認)',
'already_registered' => '既にアカウントをお持ちですか?',
],
];

117
src/lang/ko/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => '대시보드',
'knowledge_base' => '지식 베이스',
'profile' => '프로필',
'user_management' => '사용자 관리',
'logout' => '로그아웃',
'login' => '로그인',
'register' => '회원가입',
],
// Documents
'documents' => [
'title' => '문서',
'new_document' => '새 문서',
'edit_document' => '문서 편집',
'edit' => '편집',
'delete' => '삭제',
'save' => '저장',
'cancel' => '취소',
'created_by' => '작성자',
'updated' => '업데이트',
'path' => '경로',
'last_modified' => '마지막 수정',
'no_documents' => '문서를 찾을 수 없습니다',
'search_placeholder' => '문서 검색...',
'create_success' => '문서가 성공적으로 생성되었습니다!',
'update_success' => '문서가 성공적으로 업데이트되었습니다!',
'delete_success' => '문서가 성공적으로 삭제되었습니다!',
'delete_confirm' => '이 문서를 삭제하시겠습니까?',
'linked_references' => '연결된 참조',
'title_label' => '제목',
'title_placeholder' => '문서 제목 (예: Laravel/Livewire/Components)',
'title_hint' => '팁: 제목에 슬래시(/)를 사용하면 문서를 폴더로 자동 정리할 수 있습니다',
'content_label' => '내용',
'content_placeholder' => '여기에 마크다운을 작성하세요...',
'saving' => '저장 중...',
],
// Quick Switcher
'quick_switcher' => [
'title' => '빠른 전환',
'placeholder' => '문서 검색...',
'no_results' => '문서를 찾을 수 없습니다',
'navigate' => '탐색',
'select' => '선택',
'close' => '닫기',
],
// Admin
'admin' => [
'user_management' => '사용자 관리',
'new_user' => '새 사용자',
'edit_user' => '사용자 편집',
'create_user' => '사용자 생성',
'users' => '사용자',
'name' => '이름',
'email' => '이메일',
'password' => '비밀번호',
'password_confirmation' => '비밀번호 확인',
'password_hint' => '현재 비밀번호를 유지하려면 비워두세요.',
'role' => '역할',
'admin' => '관리자',
'user' => '일반 사용자',
'grant_admin' => '관리자 권한 부여',
'created_at' => '생성일',
'actions' => '작업',
'edit' => '편집',
'delete' => '삭제',
'no_users' => '사용자를 찾을 수 없습니다.',
'create_success' => '사용자가 성공적으로 생성되었습니다.',
'update_success' => '사용자가 성공적으로 업데이트되었습니다.',
'delete_success' => '사용자가 성공적으로 삭제되었습니다.',
'cannot_delete_self' => '자신을 삭제할 수 없습니다.',
'self_admin_warning' => '자신의 관리자 권한을 제거하면 관리 패널에 액세스할 수 없게 됩니다.',
],
// Settings
'settings' => [
'language' => '언어',
'select_language' => '언어 선택',
'language_updated' => '언어가 성공적으로 업데이트되었습니다.',
],
// Common
'common' => [
'save' => '저장',
'cancel' => '취소',
'delete' => '삭제',
'edit' => '편집',
'create' => '생성',
'update' => '업데이트',
'back' => '뒤로',
'confirm' => '확인',
'yes' => '예',
'no' => '아니오',
'loading' => '로딩 중...',
'error' => '오류',
'success' => '성공',
],
// Auth
'auth' => [
'login' => '로그인',
'register' => '회원가입',
'email' => '이메일',
'password' => '비밀번호',
'remember_me' => '로그인 상태 유지',
'forgot_password' => '비밀번호를 잊으셨나요?',
'confirm_password' => '비밀번호 확인',
'already_registered' => '이미 계정이 있으신가요?',
],
];

117
src/lang/zh-CN/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => '仪表盘',
'knowledge_base' => '知识库',
'profile' => '个人资料',
'user_management' => '用户管理',
'logout' => '退出登录',
'login' => '登录',
'register' => '注册',
],
// Documents
'documents' => [
'title' => '文档',
'new_document' => '新建文档',
'edit_document' => '编辑文档',
'edit' => '编辑',
'delete' => '删除',
'save' => '保存',
'cancel' => '取消',
'created_by' => '创建者',
'updated' => '更新时间',
'path' => '路径',
'last_modified' => '最后修改',
'no_documents' => '未找到文档',
'search_placeholder' => '搜索文档...',
'create_success' => '文档创建成功!',
'update_success' => '文档更新成功!',
'delete_success' => '文档删除成功!',
'delete_confirm' => '确定要删除此文档吗?',
'linked_references' => '链接引用',
'title_label' => '标题',
'title_placeholder' => '文档标题例如Laravel/Livewire/Components',
'title_hint' => '提示:在标题中使用斜杠(/)可自动将文档组织到文件夹中',
'content_label' => '内容',
'content_placeholder' => '在此输入Markdown内容...',
'saving' => '保存中...',
],
// Quick Switcher
'quick_switcher' => [
'title' => '快速切换',
'placeholder' => '搜索文档...',
'no_results' => '未找到文档',
'navigate' => '导航',
'select' => '选择',
'close' => '关闭',
],
// Admin
'admin' => [
'user_management' => '用户管理',
'new_user' => '新建用户',
'edit_user' => '编辑用户',
'create_user' => '创建用户',
'users' => '用户',
'name' => '姓名',
'email' => '邮箱',
'password' => '密码',
'password_confirmation' => '确认密码',
'password_hint' => '留空以保持当前密码。',
'role' => '角色',
'admin' => '管理员',
'user' => '普通用户',
'grant_admin' => '授予管理员权限',
'created_at' => '创建日期',
'actions' => '操作',
'edit' => '编辑',
'delete' => '删除',
'no_users' => '未找到用户。',
'create_success' => '用户创建成功。',
'update_success' => '用户更新成功。',
'delete_success' => '用户删除成功。',
'cannot_delete_self' => '您不能删除自己。',
'self_admin_warning' => '移除您自己的管理员权限将使您无法访问管理面板。',
],
// Settings
'settings' => [
'language' => '语言',
'select_language' => '选择语言',
'language_updated' => '语言更新成功。',
],
// Common
'common' => [
'save' => '保存',
'cancel' => '取消',
'delete' => '删除',
'edit' => '编辑',
'create' => '创建',
'update' => '更新',
'back' => '返回',
'confirm' => '确认',
'yes' => '是',
'no' => '否',
'loading' => '加载中...',
'error' => '错误',
'success' => '成功',
],
// Auth
'auth' => [
'login' => '登录',
'register' => '注册',
'email' => '邮箱',
'password' => '密码',
'remember_me' => '记住我',
'forgot_password' => '忘记密码?',
'confirm_password' => '确认密码',
'already_registered' => '已有账号?',
],
];

117
src/lang/zh-TW/messages.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
return [
// Navigation
'nav' => [
'dashboard' => '儀表板',
'knowledge_base' => '知識庫',
'profile' => '個人資料',
'user_management' => '使用者管理',
'logout' => '登出',
'login' => '登入',
'register' => '註冊',
],
// Documents
'documents' => [
'title' => '文件',
'new_document' => '新增文件',
'edit_document' => '編輯文件',
'edit' => '編輯',
'delete' => '刪除',
'save' => '儲存',
'cancel' => '取消',
'created_by' => '建立者',
'updated' => '更新時間',
'path' => '路徑',
'last_modified' => '最後修改',
'no_documents' => '找不到文件',
'search_placeholder' => '搜尋文件...',
'create_success' => '文件建立成功!',
'update_success' => '文件更新成功!',
'delete_success' => '文件刪除成功!',
'delete_confirm' => '確定要刪除此文件嗎?',
'linked_references' => '連結參照',
'title_label' => '標題',
'title_placeholder' => '文件標題例如Laravel/Livewire/Components',
'title_hint' => '提示:在標題中使用斜線(/)可自動將文件組織到資料夾中',
'content_label' => '內容',
'content_placeholder' => '在此輸入Markdown內容...',
'saving' => '儲存中...',
],
// Quick Switcher
'quick_switcher' => [
'title' => '快速切換',
'placeholder' => '搜尋文件...',
'no_results' => '找不到文件',
'navigate' => '導覽',
'select' => '選擇',
'close' => '關閉',
],
// Admin
'admin' => [
'user_management' => '使用者管理',
'new_user' => '新增使用者',
'edit_user' => '編輯使用者',
'create_user' => '建立使用者',
'users' => '使用者',
'name' => '姓名',
'email' => '電子郵件',
'password' => '密碼',
'password_confirmation' => '確認密碼',
'password_hint' => '留空以保持目前密碼。',
'role' => '角色',
'admin' => '管理員',
'user' => '一般使用者',
'grant_admin' => '授予管理員權限',
'created_at' => '建立日期',
'actions' => '操作',
'edit' => '編輯',
'delete' => '刪除',
'no_users' => '找不到使用者。',
'create_success' => '使用者建立成功。',
'update_success' => '使用者更新成功。',
'delete_success' => '使用者刪除成功。',
'cannot_delete_self' => '您無法刪除自己。',
'self_admin_warning' => '移除您自己的管理員權限將使您無法存取管理面板。',
],
// Settings
'settings' => [
'language' => '語言',
'select_language' => '選擇語言',
'language_updated' => '語言更新成功。',
],
// Common
'common' => [
'save' => '儲存',
'cancel' => '取消',
'delete' => '刪除',
'edit' => '編輯',
'create' => '建立',
'update' => '更新',
'back' => '返回',
'confirm' => '確認',
'yes' => '是',
'no' => '否',
'loading' => '載入中...',
'error' => '錯誤',
'success' => '成功',
],
// Auth
'auth' => [
'login' => '登入',
'register' => '註冊',
'email' => '電子郵件',
'password' => '密碼',
'remember_me' => '記住我',
'forgot_password' => '忘記密碼?',
'confirm_password' => '確認密碼',
'already_registered' => '已有帳號?',
],
];

View File

@@ -7,7 +7,7 @@
</svg> </svg>
</a> </a>
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> <h2 class="font-semibold text-xl text-gray-800 leading-tight">
新規ユーザー作成 {{ __('messages.admin.create_user') }}
</h2> </h2>
</div> </div>
</x-slot> </x-slot>
@@ -21,28 +21,28 @@
<!-- Name --> <!-- Name -->
<div> <div>
<x-input-label for="name" value="名前" /> <x-input-label for="name" :value="__('messages.admin.name')" />
<x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="name" /> <x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus autocomplete="name" />
<x-input-error :messages="$errors->get('name')" class="mt-2" /> <x-input-error :messages="$errors->get('name')" class="mt-2" />
</div> </div>
<!-- Email Address --> <!-- Email Address -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="email" value="メールアドレス" /> <x-input-label for="email" :value="__('messages.admin.email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autocomplete="username" /> <x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" /> <x-input-error :messages="$errors->get('email')" class="mt-2" />
</div> </div>
<!-- Password --> <!-- Password -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="password" value="パスワード" /> <x-input-label for="password" :value="__('messages.admin.password')" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" /> <x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" /> <x-input-error :messages="$errors->get('password')" class="mt-2" />
</div> </div>
<!-- Confirm Password --> <!-- Confirm Password -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="password_confirmation" value="パスワード(確認)" /> <x-input-label for="password_confirmation" :value="__('messages.admin.password_confirmation')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" required autocomplete="new-password" /> <x-text-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" /> <x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div> </div>
@@ -51,16 +51,16 @@
<div class="mt-4"> <div class="mt-4">
<label for="is_admin" class="inline-flex items-center"> <label for="is_admin" class="inline-flex items-center">
<input id="is_admin" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" name="is_admin" value="1" {{ old('is_admin') ? 'checked' : '' }}> <input id="is_admin" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" name="is_admin" value="1" {{ old('is_admin') ? 'checked' : '' }}>
<span class="ml-2 text-sm text-gray-600">管理者権限を付与する</span> <span class="ml-2 text-sm text-gray-600">{{ __('messages.admin.grant_admin') }}</span>
</label> </label>
</div> </div>
<div class="flex items-center justify-end mt-6"> <div class="flex items-center justify-end mt-6">
<a href="{{ route('admin.users.index') }}" class="text-sm text-gray-600 hover:text-gray-900 mr-4"> <a href="{{ route('admin.users.index') }}" class="text-sm text-gray-600 hover:text-gray-900 mr-4">
キャンセル {{ __('messages.common.cancel') }}
</a> </a>
<x-primary-button> <x-primary-button>
作成 {{ __('messages.common.create') }}
</x-primary-button> </x-primary-button>
</div> </div>
</form> </form>
@@ -69,4 +69,3 @@
</div> </div>
</div> </div>
</x-app-layout> </x-app-layout>

View File

@@ -7,7 +7,7 @@
</svg> </svg>
</a> </a>
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> <h2 class="font-semibold text-xl text-gray-800 leading-tight">
ユーザー編集: {{ $user->name }} {{ __('messages.admin.edit_user') }}: {{ $user->name }}
</h2> </h2>
</div> </div>
</x-slot> </x-slot>
@@ -22,29 +22,29 @@
<!-- Name --> <!-- Name -->
<div> <div>
<x-input-label for="name" value="名前" /> <x-input-label for="name" :value="__('messages.admin.name')" />
<x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name', $user->name)" required autofocus autocomplete="name" /> <x-text-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name', $user->name)" required autofocus autocomplete="name" />
<x-input-error :messages="$errors->get('name')" class="mt-2" /> <x-input-error :messages="$errors->get('name')" class="mt-2" />
</div> </div>
<!-- Email Address --> <!-- Email Address -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="email" value="メールアドレス" /> <x-input-label for="email" :value="__('messages.admin.email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $user->email)" required autocomplete="username" /> <x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $user->email)" required autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" /> <x-input-error :messages="$errors->get('email')" class="mt-2" />
</div> </div>
<!-- Password --> <!-- Password -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="password" value="パスワード" /> <x-input-label for="password" :value="__('messages.admin.password')" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" autocomplete="new-password" placeholder="変更する場合のみ入力" /> <x-text-input id="password" class="block mt-1 w-full" type="password" name="password" autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" /> <x-input-error :messages="$errors->get('password')" class="mt-2" />
<p class="mt-1 text-sm text-gray-500">変更しない場合は空欄のままにしてください。</p> <p class="mt-1 text-sm text-gray-500">{{ __('messages.admin.password_hint') }}</p>
</div> </div>
<!-- Confirm Password --> <!-- Confirm Password -->
<div class="mt-4"> <div class="mt-4">
<x-input-label for="password_confirmation" value="パスワード(確認)" /> <x-input-label for="password_confirmation" :value="__('messages.admin.password_confirmation')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" autocomplete="new-password" /> <x-text-input id="password_confirmation" class="block mt-1 w-full" type="password" name="password_confirmation" autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" /> <x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div> </div>
@@ -53,19 +53,19 @@
<div class="mt-4"> <div class="mt-4">
<label for="is_admin" class="inline-flex items-center"> <label for="is_admin" class="inline-flex items-center">
<input id="is_admin" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" name="is_admin" value="1" {{ old('is_admin', $user->is_admin) ? 'checked' : '' }}> <input id="is_admin" type="checkbox" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" name="is_admin" value="1" {{ old('is_admin', $user->is_admin) ? 'checked' : '' }}>
<span class="ml-2 text-sm text-gray-600">管理者権限を付与する</span> <span class="ml-2 text-sm text-gray-600">{{ __('messages.admin.grant_admin') }}</span>
</label> </label>
@if($user->id === auth()->id()) @if($user->id === auth()->id())
<p class="mt-1 text-sm text-yellow-600">自分自身の管理者権限を外すと、管理画面にアクセスできなくなります。</p> <p class="mt-1 text-sm text-yellow-600">{{ __('messages.admin.self_admin_warning') }}</p>
@endif @endif
</div> </div>
<div class="flex items-center justify-end mt-6"> <div class="flex items-center justify-end mt-6">
<a href="{{ route('admin.users.index') }}" class="text-sm text-gray-600 hover:text-gray-900 mr-4"> <a href="{{ route('admin.users.index') }}" class="text-sm text-gray-600 hover:text-gray-900 mr-4">
キャンセル {{ __('messages.common.cancel') }}
</a> </a>
<x-primary-button> <x-primary-button>
更新 {{ __('messages.common.update') }}
</x-primary-button> </x-primary-button>
</div> </div>
</form> </form>
@@ -74,4 +74,3 @@
</div> </div>
</div> </div>
</x-app-layout> </x-app-layout>

View File

@@ -2,13 +2,13 @@
<x-slot name="header"> <x-slot name="header">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> <h2 class="font-semibold text-xl text-gray-800 leading-tight">
ユーザー管理 {{ __('messages.admin.user_management') }}
</h2> </h2>
<a href="{{ route('admin.users.create') }}" class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-indigo-700 focus:bg-indigo-700 active:bg-indigo-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150"> <a href="{{ route('admin.users.create') }}" class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-indigo-700 focus:bg-indigo-700 active:bg-indigo-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg> </svg>
新規ユーザー {{ __('messages.admin.new_user') }}
</a> </a>
</div> </div>
</x-slot> </x-slot>
@@ -36,19 +36,19 @@
ID ID
</th> </th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
名前 {{ __('messages.admin.name') }}
</th> </th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
メールアドレス {{ __('messages.admin.email') }}
</th> </th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
権限 {{ __('messages.admin.role') }}
</th> </th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"> <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
登録日 {{ __('messages.admin.created_at') }}
</th> </th>
<th scope="col" class="relative px-6 py-3"> <th scope="col" class="relative px-6 py-3">
<span class="sr-only">操作</span> <span class="sr-only">{{ __('messages.admin.actions') }}</span>
</th> </th>
</tr> </tr>
</thead> </thead>
@@ -78,11 +78,11 @@
<td class="px-6 py-4 whitespace-nowrap"> <td class="px-6 py-4 whitespace-nowrap">
@if($user->is_admin) @if($user->is_admin)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800"> <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800">
管理者 {{ __('messages.admin.admin') }}
</span> </span>
@else @else
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"> <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">
一般ユーザー {{ __('messages.admin.user') }}
</span> </span>
@endif @endif
</td> </td>
@@ -90,12 +90,12 @@
{{ $user->created_at->format('Y/m/d H:i') }} {{ $user->created_at->format('Y/m/d H:i') }}
</td> </td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<a href="{{ route('admin.users.edit', $user) }}" class="text-indigo-600 hover:text-indigo-900 mr-3">編集</a> <a href="{{ route('admin.users.edit', $user) }}" class="text-indigo-600 hover:text-indigo-900 mr-3">{{ __('messages.admin.edit') }}</a>
@if($user->id !== auth()->id()) @if($user->id !== auth()->id())
<form action="{{ route('admin.users.destroy', $user) }}" method="POST" class="inline" onsubmit="return confirm('本当に削除しますか?')"> <form action="{{ route('admin.users.destroy', $user) }}" method="POST" class="inline" onsubmit="return confirm('{{ __('messages.documents.delete_confirm') }}')">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900">削除</button> <button type="submit" class="text-red-600 hover:text-red-900">{{ __('messages.admin.delete') }}</button>
</form> </form>
@endif @endif
</td> </td>
@@ -103,7 +103,7 @@
@empty @empty
<tr> <tr>
<td colspan="6" class="px-6 py-4 text-center text-sm text-gray-500"> <td colspan="6" class="px-6 py-4 text-center text-sm text-gray-500">
ユーザーが登録されていません。 {{ __('messages.admin.no_users') }}
</td> </td>
</tr> </tr>
@endforelse @endforelse
@@ -118,4 +118,3 @@
</div> </div>
</div> </div>
</x-app-layout> </x-app-layout>

View File

@@ -15,7 +15,7 @@
<script>document.addEventListener('livewire:navigated', function() { hljs.highlightAll(); });</script> <script>document.addEventListener('livewire:navigated', function() { hljs.highlightAll(); });</script>
<style> <style>
pre code.hljs { pre code.hljs {
background: #1e1e1e !important; /* VSCode dark と同じ */ background: #1e1e1e !important;
color: #dcdcdc !important; color: #dcdcdc !important;
padding: 1rem; padding: 1rem;
border-radius: 8px; border-radius: 8px;
@@ -50,7 +50,7 @@ class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg> </svg>
Quick Switch {{ __('messages.quick_switcher.title') }}
<kbd class="ml-2 px-2 py-1 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded"> <kbd class="ml-2 px-2 py-1 text-xs font-semibold text-gray-800 bg-gray-100 border border-gray-200 rounded">
Ctrl+K Ctrl+K
</kbd> </kbd>
@@ -75,7 +75,7 @@ class="flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 f
class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring-black ring-opacity-5" class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring-black ring-opacity-5"
> >
<a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"> <a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Profile {{ __('messages.nav.profile') }}
</a> </a>
@if(Auth::user()->isAdmin()) @if(Auth::user()->isAdmin())
<a href="{{ route('admin.users.index') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"> <a href="{{ route('admin.users.index') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
@@ -83,21 +83,21 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path>
</svg> </svg>
ユーザー管理 {{ __('messages.nav.user_management') }}
</span> </span>
</a> </a>
@endif @endif
<form method="POST" action="{{ route('logout') }}"> <form method="POST" action="{{ route('logout') }}">
@csrf @csrf
<button type="submit" class="w-full text-left block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"> <button type="submit" class="w-full text-left block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
Logout {{ __('messages.nav.logout') }}
</button> </button>
</form> </form>
</div> </div>
</div> </div>
@else @else
<a href="{{ route('login') }}" class="text-sm text-gray-700 hover:text-gray-900"> <a href="{{ route('login') }}" class="text-sm text-gray-700 hover:text-gray-900">
Login {{ __('messages.nav.login') }}
</a> </a>
@endauth @endauth
</div> </div>
@@ -127,20 +127,17 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
<!-- Global Keyboard Shortcuts --> <!-- Global Keyboard Shortcuts -->
<script> <script>
document.addEventListener('keydown', function(e) { document.addEventListener('keydown', function(e) {
// Ctrl+K or Cmd+K for quick switcher
if ((e.ctrlKey || e.metaKey) && e.key === 'k') { if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault(); e.preventDefault();
window.dispatchEvent(new CustomEvent('open-quick-switcher')); window.dispatchEvent(new CustomEvent('open-quick-switcher'));
} }
}); });
// Sidebar folder state management
document.addEventListener('alpine:init', () => { document.addEventListener('alpine:init', () => {
Alpine.data('sidebarState', () => ({ Alpine.data('sidebarState', () => ({
expandedFolders: [], expandedFolders: [],
initExpandedFolders() { initExpandedFolders() {
// Load from localStorage
const stored = localStorage.getItem('kb_expanded_folders'); const stored = localStorage.getItem('kb_expanded_folders');
if (stored) { if (stored) {
try { try {
@@ -158,7 +155,6 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
} else { } else {
this.expandedFolders.push(path); this.expandedFolders.push(path);
} }
// Save to localStorage
localStorage.setItem('kb_expanded_folders', JSON.stringify(this.expandedFolders)); localStorage.setItem('kb_expanded_folders', JSON.stringify(this.expandedFolders));
}, },

View File

@@ -13,13 +13,13 @@
<!-- Navigation Links --> <!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex"> <div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')"> <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }} {{ __('messages.nav.dashboard') }}
</x-nav-link> </x-nav-link>
<x-nav-link href="/" :active="false"> <x-nav-link href="/" :active="false">
<svg class="w-4 h-4 mr-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"></path>
</svg> </svg>
{{ __('Knowledge Base') }} {{ __('messages.nav.knowledge_base') }}
</x-nav-link> </x-nav-link>
</div> </div>
</div> </div>
@@ -41,12 +41,12 @@
<x-slot name="content"> <x-slot name="content">
<x-dropdown-link :href="route('profile.edit')"> <x-dropdown-link :href="route('profile.edit')">
{{ __('Profile') }} {{ __('messages.nav.profile') }}
</x-dropdown-link> </x-dropdown-link>
@if(Auth::user()->isAdmin()) @if(Auth::user()->isAdmin())
<x-dropdown-link :href="route('admin.users.index')"> <x-dropdown-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }} {{ __('messages.nav.user_management') }}
</x-dropdown-link> </x-dropdown-link>
@endif @endif
@@ -57,7 +57,7 @@
<x-dropdown-link :href="route('logout')" <x-dropdown-link :href="route('logout')"
onclick="event.preventDefault(); onclick="event.preventDefault();
this.closest('form').submit();"> this.closest('form').submit();">
{{ __('Log Out') }} {{ __('messages.nav.logout') }}
</x-dropdown-link> </x-dropdown-link>
</form> </form>
</x-slot> </x-slot>
@@ -80,10 +80,10 @@
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden"> <div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1"> <div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')"> <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }} {{ __('messages.nav.dashboard') }}
</x-responsive-nav-link> </x-responsive-nav-link>
<x-responsive-nav-link href="/" :active="false"> <x-responsive-nav-link href="/" :active="false">
{{ __('Knowledge Base') }} {{ __('messages.nav.knowledge_base') }}
</x-responsive-nav-link> </x-responsive-nav-link>
</div> </div>
@@ -96,12 +96,12 @@
<div class="mt-3 space-y-1"> <div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')"> <x-responsive-nav-link :href="route('profile.edit')">
{{ __('Profile') }} {{ __('messages.nav.profile') }}
</x-responsive-nav-link> </x-responsive-nav-link>
@if(Auth::user()->isAdmin()) @if(Auth::user()->isAdmin())
<x-responsive-nav-link :href="route('admin.users.index')"> <x-responsive-nav-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }} {{ __('messages.nav.user_management') }}
</x-responsive-nav-link> </x-responsive-nav-link>
@endif @endif
@@ -112,7 +112,7 @@
<x-responsive-nav-link :href="route('logout')" <x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault(); onclick="event.preventDefault();
this.closest('form').submit();"> this.closest('form').submit();">
{{ __('Log Out') }} {{ __('messages.nav.logout') }}
</x-responsive-nav-link> </x-responsive-nav-link>
</form> </form>
</div> </div>

View File

@@ -15,7 +15,7 @@
<!-- Header --> <!-- Header -->
<div class="mb-6 flex items-center justify-between"> <div class="mb-6 flex items-center justify-between">
<h1 class="text-3xl font-bold text-gray-900"> <h1 class="text-3xl font-bold text-gray-900">
{{ $isEditMode ? 'Edit Document' : 'New Document' }} {{ $isEditMode ? __('messages.documents.edit_document') : __('messages.documents.new_document') }}
</h1> </h1>
<div class="flex space-x-3"> <div class="flex space-x-3">
@@ -24,22 +24,22 @@
href="{{ route('documents.show', $document) }}" href="{{ route('documents.show', $document) }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50" class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50"
> >
Cancel {{ __('messages.common.cancel') }}
</a> </a>
<button <button
wire:click="delete" wire:click="delete"
wire:confirm="Are you sure you want to delete this document?" wire:confirm="{{ __('messages.documents.delete_confirm') }}"
class="inline-flex items-center px-4 py-2 border border-red-300 rounded-md text-sm font-medium text-red-700 bg-white hover:bg-red-50" class="inline-flex items-center px-4 py-2 border border-red-300 rounded-md text-sm font-medium text-red-700 bg-white hover:bg-red-50"
> >
Delete {{ __('messages.documents.delete') }}
</button> </button>
@else @else
<a <a
href="{{ route('documents.show', 'home') }}" href="{{ route('documents.show', 'home') }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50" class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50"
> >
Cancel {{ __('messages.common.cancel') }}
</a> </a>
@endif @endif
@@ -50,7 +50,7 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparen
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"></path>
</svg> </svg>
Save {{ __('messages.documents.save') }}
</button> </button>
</div> </div>
</div> </div>
@@ -60,27 +60,27 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparen
<!-- Title --> <!-- Title -->
<div> <div>
<label for="title" class="block text-sm font-medium text-gray-700 mb-2"> <label for="title" class="block text-sm font-medium text-gray-700 mb-2">
Title {{ __('messages.documents.title_label') }}
</label> </label>
<input <input
type="text" type="text"
id="title" id="title"
wire:model="title" wire:model="title"
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"
placeholder="Document Title (use / for folders, e.g. Laravel/Livewire/Components)" placeholder="{{ __('messages.documents.title_placeholder') }}"
> >
@error('title') @error('title')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p> <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror @enderror
<p class="mt-1 text-xs text-gray-500"> <p class="mt-1 text-xs text-gray-500">
Tip: Use slashes (/) in the title to organize documents into folders automatically {{ __('messages.documents.title_hint') }}
</p> </p>
</div> </div>
<!-- Markdown Editor --> <!-- Markdown Editor -->
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-2"> <label class="block text-sm font-medium text-gray-700 mb-2">
Content {{ __('messages.documents.content_label') }}
</label> </label>
<div wire:ignore> <div wire:ignore>
<div x-data="markdownEditor()" x-init="initEditor()"> <div x-data="markdownEditor()" x-init="initEditor()">
@@ -103,12 +103,12 @@ class="w-full"
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg> </svg>
Saving... {{ __('messages.documents.saving') }}
</div> </div>
@if($isEditMode && $document) @if($isEditMode && $document)
<div> <div>
Path: <code class="text-xs bg-gray-100 px-2 py-1 rounded">{{ $document->path }}</code> {{ __('messages.documents.path') }}: <code class="text-xs bg-gray-100 px-2 py-1 rounded">{{ $document->path }}</code>
</div> </div>
@endif @endif
</div> </div>
@@ -137,7 +137,7 @@ class="w-full"
autosave: { autosave: {
enabled: false, enabled: false,
}, },
placeholder: 'Write your markdown here...', placeholder: '{{ __("messages.documents.content_placeholder") }}',
toolbar: [ toolbar: [
'bold', 'italic', 'heading', '|', 'bold', 'italic', 'heading', '|',
'quote', 'unordered-list', 'ordered-list', '|', 'quote', 'unordered-list', 'ordered-list', '|',
@@ -148,9 +148,7 @@ class="w-full"
status: ['lines', 'words', 'cursor'], status: ['lines', 'words', 'cursor'],
}); });
// エディタの変更をLivewireに反映
this.editor.codemirror.on('change', () => { this.editor.codemirror.on('change', () => {
// wire:ignoreの外にあるhidden inputを探す
const formElement = this.$el.closest('form'); const formElement = this.$el.closest('form');
const hiddenInput = formElement.querySelector('input[type="hidden"][wire\\:model="content"]'); const hiddenInput = formElement.querySelector('input[type="hidden"][wire\\:model="content"]');
if (hiddenInput) { if (hiddenInput) {

View File

@@ -14,7 +14,7 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white text-sm font-
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
</svg> </svg>
Edit {{ __('messages.documents.edit') }}
</a> </a>
@endauth @endauth
</div> </div>
@@ -22,12 +22,12 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white text-sm font-
<div class="flex items-center text-sm text-gray-500 space-x-4"> <div class="flex items-center text-sm text-gray-500 space-x-4">
@if($document->created_by) @if($document->created_by)
<span> <span>
Created by {{ $document->creator->name }} {{ __('messages.documents.created_by') }} {{ $document->creator->name }}
</span> </span>
@endif @endif
<span> <span>
Updated {{ $document->updated_at->diffForHumans() }} {{ __('messages.documents.updated') }} {{ $document->updated_at->diffForHumans() }}
</span> </span>
</div> </div>
</div> </div>
@@ -41,7 +41,7 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white text-sm font-
@if(count($backlinks) > 0) @if(count($backlinks) > 0)
<div class="border-t border-gray-200 pt-8"> <div class="border-t border-gray-200 pt-8">
<h2 class="text-xl font-semibold text-gray-900 mb-4"> <h2 class="text-xl font-semibold text-gray-900 mb-4">
Linked References {{ __('messages.documents.linked_references') }}
</h2> </h2>
<div class="space-y-3"> <div class="space-y-3">
@@ -69,11 +69,11 @@ class="block p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition"
<div class="mt-12 pt-8 border-t border-gray-200"> <div class="mt-12 pt-8 border-t border-gray-200">
<div class="grid grid-cols-2 gap-4 text-sm text-gray-500"> <div class="grid grid-cols-2 gap-4 text-sm text-gray-500">
<div> <div>
<span class="font-medium">Path:</span> <span class="font-medium">{{ __('messages.documents.path') }}:</span>
<code class="ml-2 text-xs bg-gray-100 px-2 py-1 rounded">{{ $document->path }}</code> <code class="ml-2 text-xs bg-gray-100 px-2 py-1 rounded">{{ $document->path }}</code>
</div> </div>
<div> <div>
<span class="font-medium">Last modified:</span> <span class="font-medium">{{ __('messages.documents.last_modified') }}:</span>
<span class="ml-2">{{ $document->updated_at->format('Y-m-d H:i:s') }}</span> <span class="ml-2">{{ $document->updated_at->format('Y-m-d H:i:s') }}</span>
</div> </div>
</div> </div>

View File

@@ -51,7 +51,7 @@ class="w-full max-w-2xl bg-white rounded-lg shadow-2xl"
type="text" type="text"
wire:model.live="search" wire:model.live="search"
class="w-full pl-10 pr-4 py-3 border-0 focus:ring-0 text-lg" class="w-full pl-10 pr-4 py-3 border-0 focus:ring-0 text-lg"
placeholder="Search documents..." placeholder="{{ __('messages.quick_switcher.placeholder') }}"
autocomplete="off" autocomplete="off"
> >
</div> </div>
@@ -61,7 +61,7 @@ class="w-full pl-10 pr-4 py-3 border-0 focus:ring-0 text-lg"
<div class="max-h-96 overflow-y-auto"> <div class="max-h-96 overflow-y-auto">
@if(empty($this->results)) @if(empty($this->results))
<div class="p-8 text-center text-gray-500"> <div class="p-8 text-center text-gray-500">
No documents found {{ __('messages.quick_switcher.no_results') }}
</div> </div>
@else @else
<ul class="divide-y divide-gray-200"> <ul class="divide-y divide-gray-200">
@@ -109,15 +109,15 @@ class="block px-4 py-3 hover:bg-gray-50 transition {{ $index === $selectedIndex
<span class="flex items-center"> <span class="flex items-center">
<kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-1"></kbd> <kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-1"></kbd>
<kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2"></kbd> <kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2"></kbd>
to navigate {{ __('messages.quick_switcher.navigate') }}
</span> </span>
<span class="flex items-center"> <span class="flex items-center">
<kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2"></kbd> <kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2"></kbd>
to select {{ __('messages.quick_switcher.select') }}
</span> </span>
<span class="flex items-center"> <span class="flex items-center">
<kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2">esc</kbd> <kbd class="px-2 py-1 bg-white border border-gray-300 rounded text-xs font-semibold mr-2">esc</kbd>
to close {{ __('messages.quick_switcher.close') }}
</span> </span>
</div> </div>
</div> </div>

View File

@@ -1,13 +1,13 @@
<div class="p-4" x-data="sidebarState()" x-init="initExpandedFolders()"> <div class="p-4" x-data="sidebarState()" x-init="initExpandedFolders()">
<div class="mb-4"> <div class="mb-4">
<h2 class="text-sm font-semibold text-gray-700 uppercase tracking-wider"> <h2 class="text-sm font-semibold text-gray-700 uppercase tracking-wider">
Documents {{ __('messages.documents.title') }}
</h2> </h2>
</div> </div>
@if(empty($tree)) @if(empty($tree))
<div class="text-sm text-gray-500 italic"> <div class="text-sm text-gray-500 italic">
No documents found {{ __('messages.documents.no_documents') }}
</div> </div>
@else @else
<div class="space-y-1"> <div class="space-y-1">
@@ -24,7 +24,7 @@ class="flex items-center justify-center px-4 py-2 text-sm font-medium text-white
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg> </svg>
New Document {{ __('messages.documents.new_document') }}
</a> </a>
</div> </div>
@endauth @endauth

View File

@@ -13,6 +13,12 @@
</div> </div>
</div> </div>
<div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg">
<div class="max-w-xl">
@include('profile.partials.update-locale-form')
</div>
</div>
<div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg"> <div class="p-4 sm:p-8 bg-white shadow sm:rounded-lg">
<div class="max-w-xl"> <div class="max-w-xl">
@include('profile.partials.update-password-form') @include('profile.partials.update-password-form')

View File

@@ -0,0 +1,46 @@
<section>
<header>
<h2 class="text-lg font-medium text-gray-900">
{{ __('messages.settings.language') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __('messages.settings.select_language') }}
</p>
</header>
<form method="post" action="{{ route('locale.update') }}" class="mt-6 space-y-6">
@csrf
<div>
<x-input-label for="locale" :value="__('messages.settings.language')" />
<select
id="locale"
name="locale"
class="mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
>
@foreach(\App\Http\Middleware\SetLocale::SUPPORTED_LOCALES as $code => $name)
<option value="{{ $code }}" {{ (auth()->user()->locale ?? 'en') === $code ? 'selected' : '' }}>
{{ $name }}
</option>
@endforeach
</select>
<x-input-error class="mt-2" :messages="$errors->get('locale')" />
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('messages.common.save') }}</x-primary-button>
@if (session('success'))
<p
x-data="{ show: true }"
x-show="show"
x-transition
x-init="setTimeout(() => show = false, 2000)"
class="text-sm text-gray-600"
>{{ session('success') }}</p>
@endif
</div>
</form>
</section>

View File

@@ -1,6 +1,7 @@
<?php <?php
use App\Http\Controllers\ProfileController; use App\Http\Controllers\ProfileController;
use App\Http\Controllers\LocaleController;
use App\Http\Controllers\Admin\UserController as AdminUserController; use App\Http\Controllers\Admin\UserController as AdminUserController;
use App\Livewire\DocumentViewer; use App\Livewire\DocumentViewer;
use App\Livewire\DocumentEditor; use App\Livewire\DocumentEditor;
@@ -25,6 +26,7 @@
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit'); Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update'); Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
Route::post('/locale', [LocaleController::class, 'update'])->name('locale.update');
}); });
// Admin routes // Admin routes