Khunndev
Cursor
Add debug mode to show confidence scores inside detection circles.
6544822
Raw History Blame Contribute Delete
7.75 kB
import type { Lang } from './types'
const messages = {
en: {
title: 'NPI Pipe Count',
subtitle: 'Offline AI pipe counting',
// wizard
captureSubtitle: 'Take a photo or choose from gallery',
previewTitle: 'Configure & Count',
previewBack: 'Back',
cropTitle: 'Select detection area',
cropHint: 'Drag the box or corners to frame the pipe bundle.',
cropContinue: 'Use this area',
cropUseFull: 'Use full image',
countNow: 'Count Pipes',
retake: 'Retake',
countingTitle: 'Counting pipes…',
countingHint: 'Tap anywhere to skip preview animation',
resultsBack: 'New',
tapToSkip: 'Tap to skip animation',
takePhoto: 'Take Photo',
chooseFile: 'Choose Image',
count: 'Count Pipes',
recount: 'Re-count',
newPhoto: 'Choose a different photo',
loadingModel: 'Loading model...',
modelReady: 'Model ready',
modelErrorTitle: 'Could not load the AI model',
retry: 'Retry',
cloudMode: 'Cloud mode',
fallbackServer: 'Switching to server…',
fallbackLocal: 'Switching to this device…',
inferenceMode: 'Counting mode',
inferenceServer: 'Server',
inferenceLocal: 'This device',
inferenceServerHint: 'Recommended — works on all phones',
inferenceLocalHint: 'Offline — needs a capable device',
serverUnavailable: 'Server unavailable',
serverCountFailed: 'Server counting failed. Check your connection and try again.',
serverTimeout: 'Counting took too long. Try cropping a smaller area or enable High accuracy in settings.',
processing: 'Processing...',
pleaseWait: 'This may take a moment on large photos.',
total: 'Total pipes',
groups: 'Diameter groups',
groupCount: 'Number of groups',
auto: 'Auto',
expected: 'Expected',
toolView: 'View',
toolDelete: 'Delete',
toolAdd: 'Add',
toolReassign: 'Re-tag',
toolArea: 'Area',
tools: 'Correction tools',
exportPng: 'Annotated image (PNG)',
exportJson: 'Data (JSON)',
exportCsv: 'Spreadsheet (CSV)',
export: 'Export results',
cancel: 'Cancel',
highAccuracy: 'High accuracy (multi-tile, recommended)',
filterOutliers: 'Filter outliers',
mismatch: 'Mismatch',
selectGroup: 'Tap a group, then use tools to correct detections.',
noImage: 'Capture or upload a photo of a pipe bundle. Works fully offline after first load.',
getStarted: 'Ready to count',
company: 'Nawaplastic Industry Co., Ltd.',
creditFooter: 'Digital Manufacturing · Nawaplastic',
settings: 'Settings',
apply: 'Apply',
updateApp: 'Update app',
updateAppHint: 'Reload the latest version from the server',
debugSection: 'Debug',
showConfidenceLabels: 'Show confidence scores',
showConfidenceLabelsHint: 'Display model confidence in circles instead of count numbers',
},
th: {
title: 'NPI นับท่อ',
subtitle: 'นับท่อออฟไลน์ด้วย AI',
// wizard
captureSubtitle: 'ถ่ายภาพหรือเลือกจากคลัง',
previewTitle: 'ตั้งค่าและนับ',
previewBack: 'ย้อนกลับ',
cropTitle: 'เลือกพื้นที่นับ',
cropHint: 'ลากกรอบหรือมุมเพื่อกำหนดบริเวณมัดท่อ',
cropContinue: 'ใช้พื้นที่นี้',
cropUseFull: 'ใช้รูปเต็ม',
countNow: 'นับท่อ',
retake: 'ถ่ายใหม่',
countingTitle: 'กำลังนับท่อ…',
countingHint: 'แตะเพื่อข้ามการแสดงผล',
resultsBack: 'ใหม่',
tapToSkip: 'แตะเพื่อข้ามแอนิเมชั่น',
takePhoto: 'ถ่ายภาพ',
chooseFile: 'เลือกรูป',
count: 'นับท่อ',
recount: 'นับใหม่',
newPhoto: 'เลือกรูปอื่น',
loadingModel: 'กำลังโหลดโมเดล...',
modelReady: 'โมเดลพร้อมใช้งาน',
modelErrorTitle: 'โหลดโมเดล AI ไม่สำเร็จ',
retry: 'ลองใหม่',
cloudMode: 'โหมดเซิร์ฟเวอร์',
fallbackServer: 'กำลังสลับไปเซิร์ฟเวอร์…',
fallbackLocal: 'กำลังสลับไปอุปกรณ์นี้…',
inferenceMode: 'โหมดการนับ',
inferenceServer: 'เซิร์ฟเวอร์',
inferenceLocal: 'อุปกรณ์นี้',
inferenceServerHint: 'แนะนำ — ใช้ได้ทุกเครื่อง',
inferenceLocalHint: 'ออฟไลน์ — ต้องใช้เครื่องที่รองรับ',
serverUnavailable: 'เซิร์ฟเวอร์ไม่พร้อม',
serverCountFailed: 'นับบนเซิร์ฟเวอร์ไม่สำเร็จ กรุณาตรวจสอบการเชื่อมต่อแล้วลองใหม่',
serverTimeout: 'นับใช้เวลานานเกินไป ลอง crop พื้นที่ให้เล็กลง หรือเปิดความแม่นยำสูงในการตั้งค่า',
processing: 'กำลังประมวลผล...',
pleaseWait: 'รูปขนาดใหญ่อาจใช้เวลาสักครู่',
total: 'จำนวนท่อรวม',
groups: 'กลุ่มเส้นผ่านศูนย์กลาง',
groupCount: 'จำนวนกลุ่ม',
auto: 'อัตโนมัติ',
expected: 'คาดหวัง',
toolView: 'ดู',
toolDelete: 'ลบ',
toolAdd: 'เพิ่ม',
toolReassign: 'เปลี่ยนกลุ่ม',
toolArea: 'เลือกพื้นที่',
tools: 'เครื่องมือแก้ไข',
exportPng: 'รูปพร้อมหมายเลข (PNG)',
exportJson: 'ข้อมูล (JSON)',
exportCsv: 'ตาราง (CSV)',
export: 'ส่งออกผลลัพธ์',
cancel: 'ยกเลิก',
highAccuracy: 'ความแม่นยำสูง (หลายส่วน, แนะนำ)',
filterOutliers: 'กรองค่าผิดปกติ',
mismatch: 'ไม่ตรง',
selectGroup: 'แตะเลือกกลุ่ม แล้วใช้เครื่องมือแก้ไขจุดตรวจจับ',
noImage: 'ถ่ายหรืออัปโหลดรูปมัดท่อ ใช้งานออฟไลน์ได้หลังโหลดครั้งแรก',
getStarted: 'พร้อมนับท่อ',
company: 'บริษัท นวพลาสติก อุตสาหกรรม จำกัด',
creditFooter: 'Digital Manufacturing · Nawaplastic',
settings: 'ตั้งค่า',
apply: 'ใช้',
updateApp: 'อัปเดตแอป',
updateAppHint: 'โหลดเวอร์ชันล่าสุดจากเซิร์ฟเวอร์',
debugSection: 'ดีบัก',
showConfidenceLabels: 'แสดงค่า confidence',
showConfidenceLabelsHint: 'แสดงความมั่นใจของโมเดลในวงกลม แทนหมายเลขนับ',
},
} as const
export function t(lang: Lang, key: keyof (typeof messages)['en']): string {
return messages[lang][key]
}