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

@@ -7,7 +7,7 @@
</svg>
</a>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
新規ユーザー作成
{{ __('messages.admin.create_user') }}
</h2>
</div>
</x-slot>
@@ -21,28 +21,28 @@
<!-- Name -->
<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-input-error :messages="$errors->get('name')" class="mt-2" />
</div>
<!-- Email Address -->
<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-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<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-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<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-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
@@ -51,16 +51,16 @@
<div class="mt-4">
<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' : '' }}>
<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>
</div>
<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">
キャンセル
{{ __('messages.common.cancel') }}
</a>
<x-primary-button>
作成
{{ __('messages.common.create') }}
</x-primary-button>
</div>
</form>
@@ -69,4 +69,3 @@
</div>
</div>
</x-app-layout>

View File

@@ -7,7 +7,7 @@
</svg>
</a>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
ユーザー編集: {{ $user->name }}
{{ __('messages.admin.edit_user') }}: {{ $user->name }}
</h2>
</div>
</x-slot>
@@ -22,29 +22,29 @@
<!-- Name -->
<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-input-error :messages="$errors->get('name')" class="mt-2" />
</div>
<!-- Email Address -->
<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-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" value="パスワード" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" autocomplete="new-password" placeholder="変更する場合のみ入力" />
<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" />
<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>
<!-- Confirm Password -->
<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-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
@@ -53,19 +53,19 @@
<div class="mt-4">
<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' : '' }}>
<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>
@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
</div>
<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">
キャンセル
{{ __('messages.common.cancel') }}
</a>
<x-primary-button>
更新
{{ __('messages.common.update') }}
</x-primary-button>
</div>
</form>
@@ -74,4 +74,3 @@
</div>
</div>
</x-app-layout>

View File

@@ -2,13 +2,13 @@
<x-slot name="header">
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
ユーザー管理
{{ __('messages.admin.user_management') }}
</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">
<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>
</svg>
新規ユーザー
{{ __('messages.admin.new_user') }}
</a>
</div>
</x-slot>
@@ -36,19 +36,19 @@
ID
</th>
<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 scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
メールアドレス
{{ __('messages.admin.email') }}
</th>
<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 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 scope="col" class="relative px-6 py-3">
<span class="sr-only">操作</span>
<span class="sr-only">{{ __('messages.admin.actions') }}</span>
</th>
</tr>
</thead>
@@ -78,11 +78,11 @@
<td class="px-6 py-4 whitespace-nowrap">
@if($user->is_admin)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800">
管理者
{{ __('messages.admin.admin') }}
</span>
@else
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">
一般ユーザー
{{ __('messages.admin.user') }}
</span>
@endif
</td>
@@ -90,12 +90,12 @@
{{ $user->created_at->format('Y/m/d H:i') }}
</td>
<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())
<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
@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>
@endif
</td>
@@ -103,7 +103,7 @@
@empty
<tr>
<td colspan="6" class="px-6 py-4 text-center text-sm text-gray-500">
ユーザーが登録されていません。
{{ __('messages.admin.no_users') }}
</td>
</tr>
@endforelse
@@ -118,4 +118,3 @@
</div>
</div>
</x-app-layout>

View File

@@ -15,7 +15,7 @@
<script>document.addEventListener('livewire:navigated', function() { hljs.highlightAll(); });</script>
<style>
pre code.hljs {
background: #1e1e1e !important; /* VSCode dark と同じ */
background: #1e1e1e !important;
color: #dcdcdc !important;
padding: 1rem;
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">
<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>
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">
Ctrl+K
</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"
>
<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>
@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">
@@ -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">
<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>
ユーザー管理
{{ __('messages.nav.user_management') }}
</span>
</a>
@endif
<form method="POST" action="{{ route('logout') }}">
@csrf
<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>
</form>
</div>
</div>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 hover:text-gray-900">
Login
{{ __('messages.nav.login') }}
</a>
@endauth
</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 -->
<script>
document.addEventListener('keydown', function(e) {
// Ctrl+K or Cmd+K for quick switcher
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault();
window.dispatchEvent(new CustomEvent('open-quick-switcher'));
}
});
// Sidebar folder state management
document.addEventListener('alpine:init', () => {
Alpine.data('sidebarState', () => ({
expandedFolders: [],
initExpandedFolders() {
// Load from localStorage
const stored = localStorage.getItem('kb_expanded_folders');
if (stored) {
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 {
this.expandedFolders.push(path);
}
// Save to localStorage
localStorage.setItem('kb_expanded_folders', JSON.stringify(this.expandedFolders));
},

View File

@@ -13,13 +13,13 @@
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
{{ __('messages.nav.dashboard') }}
</x-nav-link>
<x-nav-link href="/" :active="false">
<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>
</svg>
{{ __('Knowledge Base') }}
{{ __('messages.nav.knowledge_base') }}
</x-nav-link>
</div>
</div>
@@ -41,12 +41,12 @@
<x-slot name="content">
<x-dropdown-link :href="route('profile.edit')">
{{ __('Profile') }}
{{ __('messages.nav.profile') }}
</x-dropdown-link>
@if(Auth::user()->isAdmin())
<x-dropdown-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }}
{{ __('messages.nav.user_management') }}
</x-dropdown-link>
@endif
@@ -57,7 +57,7 @@
<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
{{ __('messages.nav.logout') }}
</x-dropdown-link>
</form>
</x-slot>
@@ -80,10 +80,10 @@
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
{{ __('messages.nav.dashboard') }}
</x-responsive-nav-link>
<x-responsive-nav-link href="/" :active="false">
{{ __('Knowledge Base') }}
{{ __('messages.nav.knowledge_base') }}
</x-responsive-nav-link>
</div>
@@ -96,12 +96,12 @@
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')">
{{ __('Profile') }}
{{ __('messages.nav.profile') }}
</x-responsive-nav-link>
@if(Auth::user()->isAdmin())
<x-responsive-nav-link :href="route('admin.users.index')">
{{ __('ユーザー管理') }}
{{ __('messages.nav.user_management') }}
</x-responsive-nav-link>
@endif
@@ -112,7 +112,7 @@
<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
{{ __('messages.nav.logout') }}
</x-responsive-nav-link>
</form>
</div>

View File

@@ -15,7 +15,7 @@
<!-- Header -->
<div class="mb-6 flex items-center justify-between">
<h1 class="text-3xl font-bold text-gray-900">
{{ $isEditMode ? 'Edit Document' : 'New Document' }}
{{ $isEditMode ? __('messages.documents.edit_document') : __('messages.documents.new_document') }}
</h1>
<div class="flex space-x-3">
@@ -24,22 +24,22 @@
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"
>
Cancel
{{ __('messages.common.cancel') }}
</a>
<button
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"
>
Delete
{{ __('messages.documents.delete') }}
</button>
@else
<a
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"
>
Cancel
{{ __('messages.common.cancel') }}
</a>
@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">
<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>
Save
{{ __('messages.documents.save') }}
</button>
</div>
</div>
@@ -60,27 +60,27 @@ class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparen
<!-- Title -->
<div>
<label for="title" class="block text-sm font-medium text-gray-700 mb-2">
Title
{{ __('messages.documents.title_label') }}
</label>
<input
type="text"
id="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"
placeholder="Document Title (use / for folders, e.g. Laravel/Livewire/Components)"
placeholder="{{ __('messages.documents.title_placeholder') }}"
>
@error('title')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<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>
</div>
<!-- Markdown Editor -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Content
{{ __('messages.documents.content_label') }}
</label>
<div wire:ignore>
<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>
<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>
Saving...
{{ __('messages.documents.saving') }}
</div>
@if($isEditMode && $document)
<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>
@endif
</div>
@@ -137,7 +137,7 @@ class="w-full"
autosave: {
enabled: false,
},
placeholder: 'Write your markdown here...',
placeholder: '{{ __("messages.documents.content_placeholder") }}',
toolbar: [
'bold', 'italic', 'heading', '|',
'quote', 'unordered-list', 'ordered-list', '|',
@@ -148,9 +148,7 @@ class="w-full"
status: ['lines', 'words', 'cursor'],
});
// エディタの変更をLivewireに反映
this.editor.codemirror.on('change', () => {
// wire:ignoreの外にあるhidden inputを探す
const formElement = this.$el.closest('form');
const hiddenInput = formElement.querySelector('input[type="hidden"][wire\\:model="content"]');
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">
<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>
Edit
{{ __('messages.documents.edit') }}
</a>
@endauth
</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">
@if($document->created_by)
<span>
Created by {{ $document->creator->name }}
{{ __('messages.documents.created_by') }} {{ $document->creator->name }}
</span>
@endif
<span>
Updated {{ $document->updated_at->diffForHumans() }}
{{ __('messages.documents.updated') }} {{ $document->updated_at->diffForHumans() }}
</span>
</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)
<div class="border-t border-gray-200 pt-8">
<h2 class="text-xl font-semibold text-gray-900 mb-4">
Linked References
{{ __('messages.documents.linked_references') }}
</h2>
<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="grid grid-cols-2 gap-4 text-sm text-gray-500">
<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>
</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>
</div>
</div>

View File

@@ -51,7 +51,7 @@ class="w-full max-w-2xl bg-white rounded-lg shadow-2xl"
type="text"
wire:model.live="search"
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"
>
</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">
@if(empty($this->results))
<div class="p-8 text-center text-gray-500">
No documents found
{{ __('messages.quick_switcher.no_results') }}
</div>
@else
<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">
<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>
to navigate
{{ __('messages.quick_switcher.navigate') }}
</span>
<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>
to select
{{ __('messages.quick_switcher.select') }}
</span>
<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>
to close
{{ __('messages.quick_switcher.close') }}
</span>
</div>
</div>

View File

@@ -1,13 +1,13 @@
<div class="p-4" x-data="sidebarState()" x-init="initExpandedFolders()">
<div class="mb-4">
<h2 class="text-sm font-semibold text-gray-700 uppercase tracking-wider">
Documents
{{ __('messages.documents.title') }}
</h2>
</div>
@if(empty($tree))
<div class="text-sm text-gray-500 italic">
No documents found
{{ __('messages.documents.no_documents') }}
</div>
@else
<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">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
</svg>
New Document
{{ __('messages.documents.new_document') }}
</a>
</div>
@endauth

View File

@@ -13,6 +13,12 @@
</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="max-w-xl">
@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>