Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions admin/inertia/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import NotificationsProvider from '~/providers/NotificationProvider'
import { ThemeProvider } from '~/providers/ThemeProvider'
import { UsePageProps } from '../../types/system'
import '../i18n'

const appName = import.meta.env.VITE_APP_NAME || 'Project N.O.M.A.D.'
const queryClient = new QueryClient()
Expand Down Expand Up @@ -40,11 +41,16 @@ createInertiaApp({
createRoot(el).render(
<QueryClientProvider client={queryClient}>
<ThemeProvider>
<TransmitProvider baseUrl={window.location.origin} enableLogging={environment === 'development'}>
<TransmitProvider
baseUrl={window.location.origin}
enableLogging={environment === 'development'}
>
<NotificationsProvider>
<ModalsProvider>
<App {...props} />
{showDevtools && <ReactQueryDevtools initialIsOpen={false} buttonPosition='bottom-left' />}
{showDevtools && (
<ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-left" />
)}
</ModalsProvider>
</NotificationsProvider>
</TransmitProvider>
Expand Down
31 changes: 31 additions & 0 deletions admin/inertia/components/LanguageSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useTranslation } from 'react-i18next'

const languages = [
{ code: 'en', name: 'English', flag: '🇺🇸' },
{ code: 'zh', name: '中文', flag: '🇨🇳' },
]

export default function LanguageSwitcher() {
const { i18n } = useTranslation()

return (
<div className="flex items-center gap-2">
<span className="text-sm text-gray-500">Language:</span>
<div className="flex gap-1">
{languages.map((lang) => (
<button
key={lang.code}
onClick={() => i18n.changeLanguage(lang.code)}
className={`px-3 py-1 rounded text-sm transition-colors ${
i18n.language === lang.code
? 'bg-desert-green text-white'
: 'bg-gray-200 hover:bg-gray-300 text-gray-700'
}`}
>
{lang.flag} {lang.name}
</button>
))}
</div>
</div>
)
}
29 changes: 29 additions & 0 deletions admin/inertia/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import LanguageDetector from 'i18next-browser-languagedetector'

import en from './locales/en.json'
import zh from './locales/zh.json'

const resources = {
en: { translation: en },
zh: { translation: zh },
}

i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: 'en',
supportedLngs: ['en', 'zh'],
interpolation: {
escapeValue: false,
},
detection: {
order: ['localStorage', 'navigator'],
caches: ['localStorage'],
},
})

export default i18n
144 changes: 144 additions & 0 deletions admin/inertia/i18n/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"common": {
"home": "Home",
"settings": "Settings",
"docs": "Docs",
"chat": "Chat",
"maps": "Maps",
"search": "Search",
"save": "Save",
"cancel": "Cancel",
"delete": "Delete",
"edit": "Edit",
"install": "Install",
"uninstall": "Uninstall",
"start": "Start",
"stop": "Stop",
"restart": "Restart",
"loading": "Loading...",
"error": "Error",
"success": "Success",
"warning": "Warning",
"info": "Info",
"confirm": "Confirm",
"yes": "Yes",
"no": "No",
"enabled": "Enabled",
"disabled": "Disabled",
"unknown": "Unknown",
"back": "Back",
"next": "Next",
"previous": "Previous",
"close": "Close",
"submit": "Submit",
"reset": "Reset"
},
"home": {
"title": "Command Center",
"subtitle": "Your offline knowledge and education hub",
"updateAvailable": "An update is available for Project N.O.M.A.D.!",
"goToSettings": "Go to Settings",
"startHere": "Start here!",
"poweredBy": "Powered by",
"easySetupDesc": "Not sure where to start? Use the setup wizard to quickly configure your N.O.M.A.D.!",
"installAppsDesc": "Not seeing your favorite app? Install it here!",
"docsDesc": "Read Project N.O.M.A.D. manuals and guides",
"settingsDesc": "Configure your N.O.M.A.D. settings"
},
"menu": {
"maps": "Maps",
"easySetup": "Easy Setup",
"installApps": "Install Apps",
"docs": "Docs",
"settings": "Settings"
},
"maps": {
"title": "Offline Maps",
"viewOffline": "View offline maps",
"search": "Search locations...",
"noResults": "No results found",
"loadingMap": "Loading map...",
"offline": "Offline map - no internet required"
},
"chat": {
"title": "AI Assistant",
"placeholder": "Ask me anything...",
"thinking": "Thinking...",
"noMessages": "Start a conversation with the AI assistant",
"uploadDocument": "Upload Document",
"knowledgeBase": "Knowledge Base"
},
"settings": {
"title": "Settings",
"system": "System",
"apps": "Apps",
"models": "Models",
"maps": "Maps",
"mapsManager": "Maps Manager",
"benchmark": "Benchmark",
"update": "Update",
"checkUpdates": "Check for Updates",
"legal": "Legal",
"support": "Support",
"supportProject": "Support the Project",
"contentExplorer": "Content Explorer",
"contentManager": "Content Manager",
"serviceLogs": "Service Logs & Metrics"
},
"system": {
"title": "System Settings",
"hostname": "Hostname",
"version": "Version",
"uptime": "Uptime",
"storage": "Storage",
"memory": "Memory",
"cpu": "CPU",
"network": "Network",
"theme": "Theme",
"language": "Language",
"darkMode": "Dark Mode",
"lightMode": "Light Mode"
},
"apps": {
"title": "Install Apps",
"installed": "Installed",
"notInstalled": "Not Installed",
"installing": "Installing...",
"noApps": "No apps available"
},
"models": {
"title": "AI Models",
"download": "Download",
"downloading": "Downloading...",
"downloaded": "Downloaded",
"delete": "Delete Model",
"noModels": "No models installed"
},
"easySetup": {
"title": "Easy Setup",
"welcome": "Welcome to Project N.O.M.A.D.!",
"getStarted": "Let's get you started with the basics.",
"next": "Next",
"skip": "Skip",
"complete": "Complete"
},
"docs": {
"title": "Documentation",
"searchDocs": "Search documentation...",
"noResults": "No documentation found"
},
"about": {
"title": "About Project N.O.M.A.D.",
"description": "Project N.O.M.A.D. (Node for Offline Media, Archives, and Data) is an offline-first knowledge and education server.",
"version": "Version",
"license": "License",
"github": "GitHub",
"website": "Website"
},
"errors": {
"notFound": "Page Not Found",
"serverError": "Server Error",
"goHome": "Go to Home",
"tryAgain": "Try Again"
}
}
144 changes: 144 additions & 0 deletions admin/inertia/i18n/locales/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"common": {
"home": "首页",
"settings": "设置",
"docs": "文档",
"chat": "聊天",
"maps": "地图",
"search": "搜索",
"save": "保存",
"cancel": "取消",
"delete": "删除",
"edit": "编辑",
"install": "安装",
"uninstall": "卸载",
"start": "启动",
"stop": "停止",
"restart": "重启",
"loading": "加载中...",
"error": "错误",
"success": "成功",
"warning": "警告",
"info": "信息",
"confirm": "确认",
"yes": "是",
"no": "否",
"enabled": "已启用",
"disabled": "已禁用",
"unknown": "未知",
"back": "返回",
"next": "下一步",
"previous": "上一步",
"close": "关闭",
"submit": "提交",
"reset": "重置"
},
"home": {
"title": "控制中心",
"subtitle": "您的离线知识与教育中心",
"updateAvailable": "Project N.O.M.A.D. 有可用更新!",
"goToSettings": "前往设置",
"startHere": "从这里开始!",
"poweredBy": "技术支持",
"easySetupDesc": "不确定从哪里开始?使用设置向导快速配置您的 N.O.M.A.D.!",
"installAppsDesc": "没有看到您想要的应用?在这里安装!",
"docsDesc": "阅读 Project N.O.M.A.D. 手册和指南",
"settingsDesc": "配置您的 N.O.M.A.D. 设置"
},
"menu": {
"maps": "地图",
"easySetup": "快速设置",
"installApps": "安装应用",
"docs": "文档",
"settings": "设置"
},
"maps": {
"title": "离线地图",
"viewOffline": "查看离线地图",
"search": "搜索位置...",
"noResults": "未找到结果",
"loadingMap": "加载地图中...",
"offline": "离线地图 - 无需互联网"
},
"chat": {
"title": "AI 助手",
"placeholder": "问我任何问题...",
"thinking": "思考中...",
"noMessages": "开始与 AI 助手对话",
"uploadDocument": "上传文档",
"knowledgeBase": "知识库"
},
"settings": {
"title": "设置",
"system": "系统",
"apps": "应用",
"models": "模型",
"maps": "地图",
"mapsManager": "地图管理器",
"benchmark": "基准测试",
"update": "更新",
"checkUpdates": "检查更新",
"legal": "法律",
"support": "支持",
"supportProject": "支持项目",
"contentExplorer": "内容浏览器",
"contentManager": "内容管理器",
"serviceLogs": "服务日志和指标"
},
"system": {
"title": "系统设置",
"hostname": "主机名",
"version": "版本",
"uptime": "运行时间",
"storage": "存储",
"memory": "内存",
"cpu": "处理器",
"network": "网络",
"theme": "主题",
"language": "语言",
"darkMode": "深色模式",
"lightMode": "浅色模式"
},
"apps": {
"title": "安装应用",
"installed": "已安装",
"notInstalled": "未安装",
"installing": "安装中...",
"noApps": "没有可用的应用"
},
"models": {
"title": "AI 模型",
"download": "下载",
"downloading": "下载中...",
"downloaded": "已下载",
"delete": "删除模型",
"noModels": "没有已安装的模型"
},
"easySetup": {
"title": "快速设置",
"welcome": "欢迎使用 Project N.O.M.A.D.!",
"getStarted": "让我们从基础设置开始。",
"next": "下一步",
"skip": "跳过",
"complete": "完成"
},
"docs": {
"title": "文档",
"searchDocs": "搜索文档...",
"noResults": "未找到文档"
},
"about": {
"title": "关于 Project N.O.M.A.D.",
"description": "Project N.O.M.A.D.(离线媒体、档案和数据节点)是一个离线优先的知识与教育服务器。",
"version": "版本",
"license": "许可证",
"github": "GitHub",
"website": "网站"
},
"errors": {
"notFound": "页面未找到",
"serverError": "服务器错误",
"goHome": "返回首页",
"tryAgain": "重试"
}
}
Loading