i18n all /dashboard/ corpus pages for en/no/uk/pl

- Add require_once bootstrap.php to all 6 dashboard page files so
  dbnToolsT() is available before layout_dashboard.php is included
- Add dash_upload_category_lbl key to no/uk/pl sections of i18n.php
  (was only in English); Kategori/Категорія/Kategoria
- Fix broken ternary on upload.php Category label — replace with
  dbnToolsT('dash_upload_category_lbl', $uiLang)
- layout_dashboard.php outputs window.DBN_I18N with all js_* keys
  so dashboard JS reads locale-aware strings from PHP translations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 20:10:57 +02:00
parent 90117fa9de
commit a9e64b65ce
8 changed files with 886 additions and 197 deletions
+89 -6
View File
@@ -45,11 +45,11 @@ if ($dashAuthUser !== null) {
}
$dashboardNav = [
'index' => ['url' => '/dashboard/', 'label' => 'Oversikt', 'sub' => 'Overview'],
'documents' => ['url' => '/dashboard/documents.php', 'label' => 'Dokumenter', 'sub' => 'Documents'],
'upload' => ['url' => '/dashboard/upload.php', 'label' => 'Last opp', 'sub' => 'Upload'],
'chat' => ['url' => '/dashboard/chat.php', 'label' => 'Spør', 'sub' => 'Ask'],
'settings' => ['url' => '/dashboard/settings.php', 'label' => 'Innstillinger', 'sub' => 'Settings'],
'index' => ['url' => '/dashboard/', 'label' => dbnToolsT('dash_nav_overview', $uiLang), 'sub' => 'Overview'],
'documents' => ['url' => '/dashboard/documents.php', 'label' => dbnToolsT('dash_nav_documents', $uiLang), 'sub' => 'Documents'],
'upload' => ['url' => '/dashboard/upload.php', 'label' => dbnToolsT('dash_nav_upload', $uiLang), 'sub' => 'Upload'],
'chat' => ['url' => '/dashboard/chat.php', 'label' => dbnToolsT('dash_nav_ask', $uiLang), 'sub' => 'Ask'],
'settings' => ['url' => '/dashboard/settings.php', 'label' => dbnToolsT('dash_nav_settings', $uiLang), 'sub' => 'Settings'],
];
?>
<!doctype html>
@@ -57,7 +57,7 @@ $dashboardNav = [
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($dashboardTitle) ?> · Min korpus · Do Better Norge</title>
<title><?= htmlspecialchars($dashboardTitle) ?> · <?= htmlspecialchars(dbnToolsT('dash_page_subtitle', $uiLang)) ?> · Do Better Norge</title>
<link rel="stylesheet" href="/assets/css/tools.css">
<link rel="stylesheet" href="/assets/css/dashboard.css">
</head>
@@ -71,6 +71,89 @@ window.DBN_DASHBOARD = {
corpusId: <?= (int)$dashboardTenant['corpus_id'] ?>,
apiBase: '/api/dashboard'
};
window.DBN_I18N = <?= json_encode([
'locale' => dbnToolsT('js_locale', $uiLang),
'status_ready' => dbnToolsT('js_status_ready', $uiLang),
'status_pending' => dbnToolsT('js_status_pending', $uiLang),
'status_processing' => dbnToolsT('js_status_processing', $uiLang),
'status_error' => dbnToolsT('js_status_error', $uiLang),
'th_title' => dbnToolsT('js_th_title', $uiLang),
'th_status' => dbnToolsT('js_th_status', $uiLang),
'th_chunks' => dbnToolsT('js_th_chunks', $uiLang),
'th_added' => dbnToolsT('js_th_added', $uiLang),
'th_category' => dbnToolsT('js_th_category', $uiLang),
'loading' => dbnToolsT('js_loading', $uiLang),
'loading_docs' => dbnToolsT('js_loading_docs', $uiLang),
'empty_docs' => dbnToolsT('js_empty_docs', $uiLang),
'empty_docs_link' => dbnToolsT('js_empty_docs_link', $uiLang),
'empty_filter' => dbnToolsT('js_empty_filter', $uiLang),
'error_loading' => dbnToolsT('js_error_loading', $uiLang),
'kpi_docs' => dbnToolsT('js_kpi_docs', $uiLang),
'kpi_chunks' => dbnToolsT('js_kpi_chunks', $uiLang),
'kpi_ready' => dbnToolsT('js_kpi_ready', $uiLang),
'kpi_last' => dbnToolsT('js_kpi_last', $uiLang),
'kpi_of_quota' => dbnToolsT('js_kpi_of_quota', $uiLang),
'kpi_searchable' => dbnToolsT('js_kpi_searchable', $uiLang),
'kpi_of_total' => dbnToolsT('js_kpi_of_total', $uiLang),
'kpi_date_label' => dbnToolsT('js_kpi_date_label', $uiLang),
'get_started' => dbnToolsT('js_get_started', $uiLang),
'see_all' => dbnToolsT('js_see_all', $uiLang),
'recent_activity' => dbnToolsT('js_recent_activity', $uiLang),
'upload_docs_btn' => dbnToolsT('js_upload_docs_btn', $uiLang),
'ask_btn' => dbnToolsT('js_ask_btn', $uiLang),
'browse_btn' => dbnToolsT('js_browse_btn', $uiLang),
'pager_showing' => dbnToolsT('js_pager_showing', $uiLang),
'delete_selected' => dbnToolsT('js_delete_selected', $uiLang),
'delete_n_selected' => dbnToolsT('js_delete_n_selected', $uiLang),
'delete_docs_confirm'=> dbnToolsT('js_delete_docs_confirm', $uiLang),
'prev' => dbnToolsT('js_prev', $uiLang),
'next' => dbnToolsT('js_next', $uiLang),
'filter_all_status' => dbnToolsT('js_filter_all_status', $uiLang),
'filter_placeholder'=> dbnToolsT('js_filter_placeholder', $uiLang),
'chat_thinking' => dbnToolsT('js_chat_thinking', $uiLang),
'chat_save' => dbnToolsT('js_chat_save', $uiLang),
'chat_copy' => dbnToolsT('js_chat_copy', $uiLang),
'chat_copied' => dbnToolsT('js_chat_copied', $uiLang),
'chat_passages_meta'=> dbnToolsT('js_chat_passages_meta', $uiLang),
'chat_save_unavail' => dbnToolsT('js_chat_save_unavail', $uiLang),
'tab_preview' => dbnToolsT('js_tab_preview', $uiLang),
'tab_chunks' => dbnToolsT('js_tab_chunks', $uiLang),
'tab_related' => dbnToolsT('js_tab_related', $uiLang),
'tab_edit' => dbnToolsT('js_tab_edit', $uiLang),
'words' => dbnToolsT('js_words', $uiLang),
'passages_label' => dbnToolsT('js_passages_label', $uiLang),
'added_at' => dbnToolsT('js_added_at', $uiLang),
'tags_label' => dbnToolsT('js_tags_label', $uiLang),
'source_url_label' => dbnToolsT('js_source_url_label', $uiLang),
'back' => dbnToolsT('js_back', $uiLang),
'delete_btn' => dbnToolsT('js_delete_btn', $uiLang),
'save_changes' => dbnToolsT('js_save_changes', $uiLang),
'saving' => dbnToolsT('js_saving', $uiLang),
'saved_at' => dbnToolsT('js_saved_at', $uiLang),
'delete_doc_confirm'=> dbnToolsT('js_delete_doc_confirm', $uiLang),
'loading_related' => dbnToolsT('js_loading_related', $uiLang),
'no_citations' => dbnToolsT('js_no_citations', $uiLang),
'graph_unavailable' => dbnToolsT('js_graph_unavailable', $uiLang),
'no_chunks' => dbnToolsT('js_no_chunks', $uiLang),
'content_empty' => dbnToolsT('js_content_empty', $uiLang),
'doc_not_found' => dbnToolsT('js_doc_not_found', $uiLang),
'missing_doc_id' => dbnToolsT('js_missing_doc_id', $uiLang),
'upload_select_file'=> dbnToolsT('js_upload_select_file', $uiLang),
'upload_indexing' => dbnToolsT('js_upload_indexing', $uiLang),
'upload_saving' => dbnToolsT('js_upload_saving', $uiLang),
'upload_queuing' => dbnToolsT('js_upload_queuing', $uiLang),
'upload_drop_hint' => dbnToolsT('js_upload_drop_hint', $uiLang),
'upload_indexed' => dbnToolsT('js_upload_indexed', $uiLang),
'upload_open_doc' => dbnToolsT('js_upload_open_doc', $uiLang),
'upload_queued' => dbnToolsT('js_upload_queued', $uiLang),
'upload_follow_docs'=> dbnToolsT('js_upload_follow_docs', $uiLang),
'upload_bg_done' => dbnToolsT('js_upload_bg_done', $uiLang),
'field_title' => dbnToolsT('js_field_title', $uiLang),
'field_category' => dbnToolsT('js_field_category', $uiLang),
'field_tags' => dbnToolsT('js_field_tags', $uiLang),
'field_lang' => dbnToolsT('js_field_lang', $uiLang),
'field_author' => dbnToolsT('js_field_author', $uiLang),
], JSON_UNESCAPED_UNICODE) ?>;
</script>
<?php include __DIR__ . '/nav.php'; ?>