Geen omschrijving

i18n.tsx 45KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. import {
  2. createContext,
  3. useCallback,
  4. useContext,
  5. useMemo,
  6. useState,
  7. type ReactNode,
  8. } from 'react';
  9. type Language = 'en' | 'th';
  10. type Params = Record<string, string | number>;
  11. const strings: Record<Language, Record<string, string>> = {
  12. en: {
  13. 'tabs.home': 'Home',
  14. 'tabs.explore': 'Explore',
  15. 'tabs.onnx': 'Leaf Scan',
  16. 'tabs.setup': 'Setup',
  17. 'tabs.blog': 'Blog',
  18. 'tabs.tasks': 'Tasks',
  19. 'tabs.fields': 'Fields',
  20. 'tabs.logbook': 'Logbook',
  21. 'tabs.taskHistory': 'History',
  22. 'setup.title': 'User Setup',
  23. 'setup.profile': 'Profile',
  24. 'setup.loading': 'Loading...',
  25. 'setup.loaded': 'Loaded saved profile.',
  26. 'setup.none': 'No profile yet. Fill the form and save.',
  27. 'setup.saving': 'Saving...',
  28. 'setup.saved': 'Saved locally.',
  29. 'setup.photo': 'Profile photo',
  30. 'setup.noPhoto': 'No photo selected.',
  31. 'setup.uploadPhoto': 'Upload photo',
  32. 'setup.exportTitle': 'Export data',
  33. 'setup.exportHint': 'Download your local data as a CSV file.',
  34. 'setup.exportButton': 'Export data',
  35. 'setup.exported': 'Exported data.',
  36. 'setup.exportError': 'Export failed.',
  37. 'setup.name': 'Name',
  38. 'setup.farmName': 'Farm name',
  39. 'setup.location': 'Location',
  40. 'setup.save': 'Save locally',
  41. 'setup.saveIndicator': 'Saved!',
  42. 'setup.language': 'Language',
  43. 'setup.lang.en': 'English',
  44. 'setup.lang.th': 'Thai',
  45. 'setup.currency': 'Default currency',
  46. 'setup.currencyPlaceholder': 'e.g. THB',
  47. 'setup.currency.thb': 'THB',
  48. 'setup.currency.usd': 'USD',
  49. 'setup.currency.eur': 'EUR',
  50. 'setup.currency.jpy': 'JPY',
  51. 'setup.demoTitle': 'Demo Data',
  52. 'setup.demoHint': 'Insert sample fields, crops, observations, and task history.',
  53. 'setup.demoButton': 'Insert demo data',
  54. 'setup.demoInserting': 'Inserting demo data...',
  55. 'setup.demoInserted': 'Demo data inserted.',
  56. 'setup.demoExists': 'Demo data already exists.',
  57. 'setup.demoError': 'Demo insert failed.',
  58. 'setup.demoClearButton': 'Clear demo data',
  59. 'setup.demoClearing': 'Clearing demo data...',
  60. 'setup.demoCleared': 'Demo data cleared.',
  61. 'setup.demoClearError': 'Clear demo failed.',
  62. 'setup.demoClearedUndo': 'Demo data cleared.',
  63. 'setup.demoUndo': 'Undo',
  64. 'setup.demoUndoDone': 'Demo data restored.',
  65. 'setup.demoUndoError': 'Undo failed.',
  66. 'onnx.title': 'Leaf Classifier',
  67. 'onnx.howTitle': 'How to use the ONNX model',
  68. 'onnx.howBody':
  69. 'This page loads the PlantVillage MobileNetV3-Small model and runs inference on a 224x224 RGB tensor. The input is normalized to 0..1 per channel.',
  70. 'onnx.sampleTitle': 'Sample code',
  71. 'onnx.testTitle': 'Test the model',
  72. 'onnx.pickImage': 'Pick image',
  73. 'onnx.runModel': 'Run model',
  74. 'onnx.status.pick': 'Pick an image to run the model.',
  75. 'onnx.status.ready': 'Ready. Tap "Run model" to classify.',
  76. 'onnx.status.preprocessing': 'Preprocessing image...',
  77. 'onnx.status.running': 'Running PlantVillage model...',
  78. 'onnx.status.done': 'Done.',
  79. 'onnx.status.nativeMissing': 'ONNX runtime not available. Use a dev build.',
  80. 'onnx.topPredictions': 'Top predictions',
  81. 'blog.title': 'Blog Posts',
  82. 'blog.loading': 'Loading posts...',
  83. 'blog.error': 'Failed to load posts.',
  84. 'blog.empty': 'No posts found.',
  85. 'blog.loadMore': 'Load more',
  86. 'blog.loadingMore': 'Loading more...',
  87. 'blog.language': 'Language',
  88. 'blog.lang.en': 'English',
  89. 'blog.lang.th': 'Thai',
  90. 'blog.lang.ja': 'Japanese',
  91. 'blog.lang.zh': 'Chinese',
  92. 'home.badge': 'Smartfarming Lite',
  93. 'home.title': 'Track fields, crops, and observations without leaving the farm.',
  94. 'home.subtitle': 'Offline-first records for daily work, photos, and crop history.',
  95. 'home.openLogbook': 'Open Logbook',
  96. 'home.todayTasks': "Today’s Tasks",
  97. 'home.quickActions': 'Quick Actions',
  98. 'home.fields': 'Fields',
  99. 'home.fieldsHint': 'Add area, notes, photos.',
  100. 'home.crops': 'Crops',
  101. 'home.cropsHint': 'Planting and harvest dates.',
  102. 'home.observations': 'Observations',
  103. 'home.observationsHint': 'Notes, severity, images.',
  104. 'home.onnx': 'Leaf Scan',
  105. 'home.onnxHint': 'Run leaf classifier.',
  106. 'home.harvests': 'Harvests',
  107. 'home.harvestsHint': 'Yield and harvest records.',
  108. 'home.sales': 'Sales',
  109. 'home.salesHint': 'Sales records and buyers.',
  110. 'home.costs': 'Costs',
  111. 'home.costsHint': 'Record expenses.',
  112. 'home.todayTitle': 'Today',
  113. 'home.todayCardTitle': 'Log your field routine',
  114. 'home.todayCardBody':
  115. 'Capture scouting notes, attach photos, and keep a clean history for the next visit.',
  116. 'home.openTasks': 'Open Tasks',
  117. 'home.taskHistory': 'Task History',
  118. 'home.learnAnalyze': 'Learn & Analyze',
  119. 'home.blogs': 'Blogs',
  120. 'home.blogsHint': 'Latest smart farming posts.',
  121. 'home.profile': 'Profile',
  122. 'home.profileHint': 'Farm info and language.',
  123. 'home.count.tasks': 'Tasks',
  124. 'home.count.history': 'History',
  125. 'tasks.title': 'Daily Tasks',
  126. 'tasks.subtitle': 'Log today’s field routine.',
  127. 'tasks.loading': 'Loading tasks...',
  128. 'tasks.empty': 'No tasks configured yet.',
  129. 'tasks.pending': 'Pending',
  130. 'tasks.done': 'Done',
  131. 'tasks.complete': 'Mark done',
  132. 'tasks.undo': 'Undo',
  133. 'tasks.notePlaceholder': 'Add notes for today...',
  134. 'tasks.photo': 'Task photo',
  135. 'tasks.pickPhoto': 'Pick photo',
  136. 'tasks.takePhoto': 'Take photo',
  137. 'tasks.cameraDenied': 'Camera permission denied.',
  138. 'tasks.cameraError': 'Camera is not available.',
  139. 'tasks.historyTitle': 'Task History',
  140. 'tasks.historyEmpty': 'No task history yet.',
  141. 'tasks.back': 'Back to Tasks',
  142. 'tasks.default.fieldCheck': 'Field check-in',
  143. 'tasks.default.fieldCheckDesc': 'Quick field condition and notes.',
  144. 'tasks.default.scouting': 'Pest/Disease scouting',
  145. 'tasks.default.scoutingDesc': 'Inspect leaves and record severity.',
  146. 'tasks.default.sensors': 'Sensor readings',
  147. 'tasks.default.sensorsDesc': 'Log soil moisture or weather snapshot.',
  148. 'fields.title': 'Fields',
  149. 'fields.loading': 'Loading fields...',
  150. 'fields.empty': 'No fields yet.',
  151. 'fields.nameRequired': 'Field name is required.',
  152. 'fields.areaInvalid': 'Area must be a number.',
  153. 'fields.saved': 'Saved.',
  154. 'fields.name': 'Field name',
  155. 'fields.area': 'Area (ha)',
  156. 'fields.areaPlaceholder': 'e.g. 1.5',
  157. 'fields.notes': 'Notes',
  158. 'fields.notesPlaceholder': 'Soil, irrigation, landmarks...',
  159. 'fields.save': 'Save field',
  160. 'fields.update': 'Update field',
  161. 'fields.cancel': 'Cancel',
  162. 'fields.edit': 'Edit',
  163. 'fields.delete': 'Delete',
  164. 'fields.deleteTitle': 'Delete field?',
  165. 'fields.deleteMessage': 'This action cannot be undone.',
  166. 'fields.new': 'New field',
  167. 'fields.unnamed': 'Unnamed field',
  168. 'fields.areaLabel': 'Area:',
  169. 'fields.photo': 'Field photo',
  170. 'fields.pickPhoto': 'Pick photo',
  171. 'fields.takePhoto': 'Take photo',
  172. 'fields.noPhoto': 'No photo selected.',
  173. 'fields.updatedAt': 'Updated:',
  174. 'logbook.title': 'Logbook',
  175. 'logbook.subtitle': 'Manage your core records.',
  176. 'logbook.fields': 'Fields',
  177. 'logbook.fieldsHint': 'Land area, notes, boundaries.',
  178. 'logbook.observations': 'Observations',
  179. 'logbook.observationsHint': 'Scouting notes and severity.',
  180. 'logbook.crops': 'Crops',
  181. 'logbook.cropsHint': 'Crop info by field.',
  182. 'logbook.tasks': 'Daily Tasks',
  183. 'logbook.tasksHint': 'Notes, photos, status.',
  184. 'logbook.history': 'Task History',
  185. 'logbook.historyHint': 'Completed entries by date.',
  186. 'logbook.harvests': 'Harvests',
  187. 'logbook.harvestsHint': 'Yield and harvest details.',
  188. 'logbook.sales': 'Sales',
  189. 'logbook.salesHint': 'Sales records and buyers.',
  190. 'logbook.costs': 'Costs',
  191. 'logbook.costsHint': 'Expenses and receipts.',
  192. 'observations.title': 'Observations',
  193. 'observations.loading': 'Loading observations...',
  194. 'observations.empty': 'No observations yet.',
  195. 'observations.saved': 'Saved.',
  196. 'observations.field': 'Field',
  197. 'observations.crop': 'Crop',
  198. 'observations.type': 'Type',
  199. 'observations.note': 'Note',
  200. 'observations.severity': 'Severity',
  201. 'observations.severityLabel': 'Severity:',
  202. 'observations.selectField': 'Select field',
  203. 'observations.selectCrop': 'Select crop',
  204. 'observations.typePlaceholder': 'e.g. scouting',
  205. 'observations.notePlaceholder': 'What did you observe?',
  206. 'observations.severityPlaceholder': '0-10',
  207. 'observations.fieldRequired': 'Field is required.',
  208. 'observations.severityInvalid': 'Severity must be a number.',
  209. 'observations.delete': 'Delete',
  210. 'observations.noField': 'No field',
  211. 'observations.noCrop': 'No crop',
  212. 'observations.untitled': 'Observation',
  213. 'observations.save': 'Save observation',
  214. 'observations.new': 'New observation',
  215. 'observations.cancel': 'Cancel',
  216. 'observations.edit': 'Edit observation',
  217. 'observations.update': 'Update observation',
  218. 'observations.photo': 'Observation photo',
  219. 'observations.pickPhoto': 'Pick photo',
  220. 'observations.takePhoto': 'Take photo',
  221. 'observations.noPhoto': 'No photo selected.',
  222. 'harvests.title': 'Harvest Records',
  223. 'harvests.loading': 'Loading harvest records...',
  224. 'harvests.empty': 'No harvest records yet.',
  225. 'harvests.saved': 'Saved.',
  226. 'harvests.new': 'New harvest',
  227. 'harvests.field': 'Field',
  228. 'harvests.crop': 'Crop',
  229. 'harvests.selectField': 'Select field',
  230. 'harvests.selectCrop': 'Select crop',
  231. 'harvests.date': 'Harvest date',
  232. 'harvests.datePlaceholder': 'YYYY-MM-DD',
  233. 'harvests.quantity': 'Quantity',
  234. 'harvests.quantityPlaceholder': 'e.g. 120',
  235. 'harvests.unit': 'Unit',
  236. 'harvests.unitPlaceholder': 'kg',
  237. 'harvests.notes': 'Notes',
  238. 'harvests.notesPlaceholder': 'Quality, weather, labor notes...',
  239. 'harvests.photo': 'Harvest photo',
  240. 'harvests.pickPhoto': 'Pick photo',
  241. 'harvests.takePhoto': 'Take photo',
  242. 'harvests.noPhoto': 'No photo selected.',
  243. 'harvests.fieldRequired': 'Field is required.',
  244. 'harvests.cropRequired': 'Crop is required.',
  245. 'harvests.quantityInvalid': 'Quantity must be a number.',
  246. 'harvests.delete': 'Delete',
  247. 'harvests.deleteTitle': 'Delete harvest record?',
  248. 'harvests.deleteMessage': 'This action cannot be undone.',
  249. 'harvests.cancel': 'Cancel',
  250. 'harvests.save': 'Save harvest',
  251. 'harvests.untitled': 'Harvest',
  252. 'harvests.noField': 'No field',
  253. 'harvests.noCrop': 'No crop',
  254. 'harvests.edit': 'Edit harvest',
  255. 'harvests.update': 'Update harvest',
  256. 'units.kg': 'kg',
  257. 'units.g': 'g',
  258. 'units.ton': 'ton',
  259. 'units.pcs': 'pcs',
  260. 'sales.title': 'Sales Records',
  261. 'sales.loading': 'Loading sales records...',
  262. 'sales.empty': 'No sales records yet.',
  263. 'sales.saved': 'Saved.',
  264. 'sales.new': 'New sale',
  265. 'sales.field': 'Field',
  266. 'sales.crop': 'Crop',
  267. 'sales.harvest': 'Harvest (optional)',
  268. 'sales.selectField': 'Select field',
  269. 'sales.selectCrop': 'Select crop',
  270. 'sales.selectHarvest': 'Select harvest',
  271. 'sales.noHarvest': 'No harvest records',
  272. 'sales.date': 'Sale date',
  273. 'sales.datePlaceholder': 'YYYY-MM-DD',
  274. 'sales.quantity': 'Quantity',
  275. 'sales.quantityPlaceholder': 'e.g. 50',
  276. 'sales.unit': 'Unit',
  277. 'sales.unitPlaceholder': 'kg',
  278. 'sales.price': 'Price',
  279. 'sales.pricePlaceholder': 'e.g. 35',
  280. 'sales.priceLabel': 'Price:',
  281. 'sales.buyer': 'Buyer',
  282. 'sales.buyerPlaceholder': 'e.g. Local market',
  283. 'sales.notes': 'Notes',
  284. 'sales.notesPlaceholder': 'Payment, transport, quality...',
  285. 'sales.fieldRequired': 'Field is required.',
  286. 'sales.cropRequired': 'Crop is required.',
  287. 'sales.quantityInvalid': 'Quantity must be a number.',
  288. 'sales.delete': 'Delete',
  289. 'sales.deleteTitle': 'Delete sales record?',
  290. 'sales.deleteMessage': 'This action cannot be undone.',
  291. 'sales.cancel': 'Cancel',
  292. 'sales.save': 'Save sale',
  293. 'sales.untitled': 'Sale',
  294. 'sales.noField': 'No field',
  295. 'sales.noCrop': 'No crop',
  296. 'sales.edit': 'Edit sale',
  297. 'sales.update': 'Update sale',
  298. 'costs.title': 'Cost Records',
  299. 'costs.loading': 'Loading costs...',
  300. 'costs.empty': 'No cost records yet.',
  301. 'costs.saved': 'Saved.',
  302. 'costs.new': 'New cost',
  303. 'costs.field': 'Field',
  304. 'costs.crop': 'Crop (optional)',
  305. 'costs.selectField': 'Select field',
  306. 'costs.selectCrop': 'Select crop',
  307. 'costs.category': 'Category',
  308. 'costs.category.seed': 'Seed',
  309. 'costs.category.fertilizer': 'Fertilizer',
  310. 'costs.category.labor': 'Labor',
  311. 'costs.category.fuel': 'Fuel',
  312. 'costs.category.equipment': 'Equipment',
  313. 'costs.category.transport': 'Transport',
  314. 'costs.category.misc': 'Misc',
  315. 'costs.categoryPlaceholder': 'e.g. Seed',
  316. 'costs.amount': 'Amount',
  317. 'costs.amountPlaceholder': 'e.g. 1200',
  318. 'costs.vendor': 'Vendor',
  319. 'costs.vendorPlaceholder': 'e.g. Local supplier',
  320. 'costs.date': 'Date',
  321. 'costs.datePlaceholder': 'YYYY-MM-DD',
  322. 'costs.notes': 'Notes',
  323. 'costs.notesPlaceholder': 'Receipt, usage, purpose...',
  324. 'costs.photo': 'Receipt photo',
  325. 'costs.pickPhoto': 'Pick photo',
  326. 'costs.takePhoto': 'Take photo',
  327. 'costs.noPhoto': 'No photo selected.',
  328. 'costs.fieldRequired': 'Field is required.',
  329. 'costs.amountInvalid': 'Amount must be a number.',
  330. 'costs.delete': 'Delete',
  331. 'costs.deleteTitle': 'Delete cost record?',
  332. 'costs.deleteMessage': 'This action cannot be undone.',
  333. 'costs.cancel': 'Cancel',
  334. 'costs.save': 'Save cost',
  335. 'costs.edit': 'Edit cost',
  336. 'costs.update': 'Update cost',
  337. 'costs.untitled': 'Cost',
  338. 'costs.noField': 'No field',
  339. 'costs.noCrop': 'No crop',
  340. 'units.kg': 'กก.',
  341. 'units.g': 'กรัม',
  342. 'units.ton': 'ตัน',
  343. 'units.pcs': 'ชิ้น',
  344. 'demo.field.north': 'North Field',
  345. 'demo.field.northNote': 'Loamy soil · drip irrigation',
  346. 'demo.field.river': 'River Plot',
  347. 'demo.field.riverNote': 'Lowland area near canal',
  348. 'demo.field.greenhouse': 'Greenhouse',
  349. 'demo.field.greenhouseNote': 'Shaded beds, irrigation daily',
  350. 'demo.field.orchard': 'Orchard Block',
  351. 'demo.field.orchardNote': 'Raised rows, windbreak on east side',
  352. 'demo.field.terrace': 'Terrace Plot',
  353. 'demo.field.terraceNote': 'Stepped slope with drip lines',
  354. 'demo.crop.tomato': 'Tomato',
  355. 'demo.crop.tomatoVariety': 'Cherry',
  356. 'demo.crop.rice': 'Rice',
  357. 'demo.crop.riceVariety': 'Jasmine',
  358. 'demo.crop.lettuce': 'Lettuce',
  359. 'demo.crop.lettuceVariety': 'Butterhead',
  360. 'demo.crop.chili': 'Chili',
  361. 'demo.crop.chiliVariety': 'Bird’s eye',
  362. 'demo.crop.cabbage': 'Cabbage',
  363. 'demo.crop.cabbageVariety': 'Green cabbage',
  364. 'demo.observation.scoutingNote': 'Early leaf spot found on edge rows.',
  365. 'demo.observation.diseaseNote': 'Disease patches visible after rain.',
  366. 'demo.observation.irrigationNote': 'Adjusted irrigation timing to evening.',
  367. 'demo.observation.pestNote': 'Aphids spotted on new growth.',
  368. 'demo.observation.nutrientNote': 'Lower leaves pale, applied foliar feed.',
  369. 'demo.task.note': 'Completed as scheduled.',
  370. 'demo.task.note2': 'Followed standard checklist.',
  371. 'demo.task.note3': 'Checked equipment and logged readings.',
  372. 'demo.harvest.note1': 'Morning harvest, good quality.',
  373. 'demo.harvest.note2': 'Harvested after light rain.',
  374. 'demo.harvest.note3': 'Sorted by size for market.',
  375. 'demo.sale.buyer1': 'Local market',
  376. 'demo.sale.buyer2': 'Wholesale buyer',
  377. 'demo.sale.buyer3': 'Restaurant partner',
  378. 'demo.sale.note1': 'Delivered same day.',
  379. 'demo.sale.note2': 'Paid in full.',
  380. 'demo.sale.note3': 'Requested weekly supply.',
  381. 'demo.cost.vendor1': 'Agro supply',
  382. 'demo.cost.vendor2': 'Fertilizer store',
  383. 'demo.cost.vendor3': 'Labor crew',
  384. 'demo.cost.note1': 'Tomato seeds and trays.',
  385. 'demo.cost.note2': 'Base fertilizer for rice plot.',
  386. 'demo.cost.note3': 'Harvest helpers (half day).',
  387. 'observations.type.scouting': 'Scouting',
  388. 'observations.type.pest': 'Pest',
  389. 'observations.type.disease': 'Disease',
  390. 'observations.type.irrigation': 'Irrigation',
  391. 'observations.type.weeds': 'Weeds',
  392. 'observations.type.nutrients': 'Nutrients',
  393. 'crops.title': 'Crops',
  394. 'crops.loading': 'Loading crops...',
  395. 'crops.empty': 'No crops yet.',
  396. 'crops.saved': 'Saved.',
  397. 'crops.field': 'Field',
  398. 'crops.selectField': 'Select field',
  399. 'crops.name': 'Crop name',
  400. 'crops.variety': 'Variety',
  401. 'crops.planting': 'Planting date',
  402. 'crops.harvest': 'Expected harvest',
  403. 'crops.namePlaceholder': 'e.g. Tomato',
  404. 'crops.varietyPlaceholder': 'e.g. Cherry',
  405. 'crops.plantingPlaceholder': 'YYYY-MM-DD',
  406. 'crops.harvestPlaceholder': 'YYYY-MM-DD',
  407. 'crops.fieldRequired': 'Field is required.',
  408. 'crops.nameRequired': 'Crop name is required.',
  409. 'crops.delete': 'Delete',
  410. 'crops.deleteTitle': 'Delete crop?',
  411. 'crops.deleteMessage': 'This action cannot be undone.',
  412. 'crops.noField': 'No field',
  413. 'crops.untitled': 'Crop',
  414. 'crops.plantingLabel': 'Planted:',
  415. 'crops.harvestLabel': 'Harvest:',
  416. 'crops.save': 'Save crop',
  417. 'crops.new': 'New crop',
  418. 'crops.photo': 'Crop photo',
  419. 'crops.pickPhoto': 'Pick photo',
  420. 'crops.takePhoto': 'Take photo',
  421. 'crops.noPhoto': 'No photo selected.',
  422. 'crops.today': 'Today',
  423. 'crops.done': 'Done',
  424. 'crops.edit': 'Edit crop',
  425. 'crops.update': 'Update crop',
  426. 'crops.cancel': 'Cancel',
  427. },
  428. th: {
  429. 'tabs.home': 'หน้าแรก',
  430. 'tabs.explore': 'สำรวจ',
  431. 'tabs.onnx': 'สแกนใบ',
  432. 'tabs.setup': 'ตั้งค่า',
  433. 'tabs.blog': 'บล็อก',
  434. 'tabs.tasks': 'งานประจำวัน',
  435. 'tabs.fields': 'แปลง',
  436. 'tabs.logbook': 'บันทึก',
  437. 'tabs.taskHistory': 'ประวัติ',
  438. 'setup.title': 'ตั้งค่าผู้ใช้',
  439. 'setup.profile': 'โปรไฟล์',
  440. 'setup.loading': 'กำลังโหลด...',
  441. 'setup.loaded': 'โหลดโปรไฟล์ที่บันทึกไว้แล้ว',
  442. 'setup.none': 'ยังไม่มีโปรไฟล์ กรอกข้อมูลแล้วกดบันทึก',
  443. 'setup.saving': 'กำลังบันทึก...',
  444. 'setup.saved': 'บันทึกไว้ในเครื่องแล้ว',
  445. 'setup.photo': 'รูปโปรไฟล์',
  446. 'setup.noPhoto': 'ยังไม่ได้เลือกรูป',
  447. 'setup.uploadPhoto': 'อัปโหลดรูป',
  448. 'setup.exportTitle': 'ส่งออกข้อมูล',
  449. 'setup.exportHint': 'ดาวน์โหลดข้อมูลในเครื่องเป็นไฟล์ CSV',
  450. 'setup.exportButton': 'ส่งออกข้อมูล',
  451. 'setup.exported': 'ส่งออกข้อมูลแล้ว',
  452. 'setup.exportError': 'ส่งออกข้อมูลไม่สำเร็จ',
  453. 'setup.name': 'ชื่อ',
  454. 'setup.farmName': 'ชื่อฟาร์ม',
  455. 'setup.location': 'ที่ตั้ง',
  456. 'setup.save': 'บันทึกในเครื่อง',
  457. 'setup.saveIndicator': 'บันทึกแล้ว',
  458. 'setup.language': 'ภาษา',
  459. 'setup.lang.en': 'English',
  460. 'setup.lang.th': 'ไทย',
  461. 'setup.currency': 'สกุลเงินเริ่มต้น',
  462. 'setup.currencyPlaceholder': 'เช่น THB',
  463. 'setup.currency.thb': 'บาท (THB)',
  464. 'setup.currency.usd': 'ดอลลาร์ (USD)',
  465. 'setup.currency.eur': 'ยูโร (EUR)',
  466. 'setup.currency.jpy': 'เยน (JPY)',
  467. 'setup.demoTitle': 'ข้อมูลตัวอย่าง',
  468. 'setup.demoHint': 'เพิ่มข้อมูลตัวอย่าง: แปลง พืช บันทึกสำรวจ และประวัติงาน',
  469. 'setup.demoButton': 'เพิ่มข้อมูลตัวอย่าง',
  470. 'setup.demoInserting': 'กำลังเพิ่มข้อมูลตัวอย่าง...',
  471. 'setup.demoInserted': 'เพิ่มข้อมูลตัวอย่างแล้ว',
  472. 'setup.demoExists': 'มีข้อมูลอยู่แล้ว',
  473. 'setup.demoError': 'เพิ่มข้อมูลไม่สำเร็จ',
  474. 'setup.demoClearButton': 'ลบข้อมูลตัวอย่าง',
  475. 'setup.demoClearing': 'กำลังลบข้อมูลตัวอย่าง...',
  476. 'setup.demoCleared': 'ลบข้อมูลตัวอย่างแล้ว',
  477. 'setup.demoClearError': 'ลบข้อมูลไม่สำเร็จ',
  478. 'setup.demoClearedUndo': 'ลบข้อมูลตัวอย่างแล้ว',
  479. 'setup.demoUndo': 'ย้อนกลับ',
  480. 'setup.demoUndoDone': 'กู้คืนข้อมูลตัวอย่างแล้ว',
  481. 'setup.demoUndoError': 'ย้อนกลับไม่สำเร็จ',
  482. 'onnx.title': 'จำแนกโรคใบพืช',
  483. 'onnx.howTitle': 'วิธีใช้โมเดล ONNX',
  484. 'onnx.howBody':
  485. 'หน้านี้โหลดโมเดล PlantVillage MobileNetV3-Small และรันอินเฟอเรนซ์ด้วยเทนเซอร์ RGB ขนาด 224x224 อินพุตถูกทำให้อยู่ในช่วง 0..1 ต่อช่องสี',
  486. 'onnx.sampleTitle': 'ตัวอย่างโค้ด',
  487. 'onnx.testTitle': 'ทดสอบโมเดล',
  488. 'onnx.pickImage': 'เลือกรูป',
  489. 'onnx.runModel': 'รันโมเดล',
  490. 'onnx.status.pick': 'เลือกรูปเพื่อรันโมเดล',
  491. 'onnx.status.ready': 'พร้อมแล้ว กด "รันโมเดล" เพื่อจำแนก',
  492. 'onnx.status.preprocessing': 'กำลังเตรียมรูป...',
  493. 'onnx.status.running': 'กำลังรันโมเดล PlantVillage...',
  494. 'onnx.status.done': 'เสร็จแล้ว',
  495. 'onnx.status.nativeMissing': 'ไม่พบ ONNX runtime โปรดใช้ dev build',
  496. 'onnx.topPredictions': 'ผลลัพธ์สูงสุด',
  497. 'blog.title': 'บทความล่าสุด',
  498. 'blog.loading': 'กำลังโหลดบทความ...',
  499. 'blog.error': 'โหลดบทความไม่สำเร็จ',
  500. 'blog.empty': 'ไม่พบบทความ',
  501. 'blog.loadMore': 'โหลดเพิ่มเติม',
  502. 'blog.loadingMore': 'กำลังโหลดเพิ่มเติม...',
  503. 'blog.language': 'ภาษา',
  504. 'blog.lang.en': 'English',
  505. 'blog.lang.th': 'ไทย',
  506. 'blog.lang.ja': 'ญี่ปุ่น',
  507. 'blog.lang.zh': 'จีน',
  508. 'home.badge': 'สมาร์ทฟาร์มมิ่ง ไลต์',
  509. 'home.title': 'ติดตามแปลง พืช และบันทึกสำรวจได้ทันทีในฟาร์ม',
  510. 'home.subtitle': 'บันทึกแบบออฟไลน์สำหรับงานประจำวัน รูปภาพ และประวัติพืช',
  511. 'home.openLogbook': 'เปิดบันทึก',
  512. 'home.todayTasks': 'งานวันนี้',
  513. 'home.quickActions': 'ทางลัด',
  514. 'home.fields': 'แปลง',
  515. 'home.fieldsHint': 'เพิ่มพื้นที่ บันทึก และรูปภาพ',
  516. 'home.crops': 'พืช',
  517. 'home.cropsHint': 'วันที่ปลูกและเก็บเกี่ยว',
  518. 'home.observations': 'บันทึกสำรวจ',
  519. 'home.observationsHint': 'บันทึก ความรุนแรง และรูปภาพ',
  520. 'home.onnx': 'สแกนใบ',
  521. 'home.onnxHint': 'รันโมเดลจำแนกใบพืช',
  522. 'home.harvests': 'เก็บเกี่ยว',
  523. 'home.harvestsHint': 'ผลผลิตและบันทึกการเก็บเกี่ยว',
  524. 'home.sales': 'ขายผลผลิต',
  525. 'home.salesHint': 'บันทึกการขายและผู้ซื้อ',
  526. 'home.costs': 'ต้นทุน',
  527. 'home.costsHint': 'บันทึกค่าใช้จ่าย',
  528. 'home.todayTitle': 'วันนี้',
  529. 'home.todayCardTitle': 'บันทึกงานประจำแปลง',
  530. 'home.todayCardBody':
  531. 'บันทึกการสำรวจ ถ่ายรูป และเก็บประวัติให้พร้อมสำหรับครั้งถัดไป',
  532. 'home.openTasks': 'เปิดงานประจำวัน',
  533. 'home.taskHistory': 'ประวัติงาน',
  534. 'home.learnAnalyze': 'เรียนรู้และวิเคราะห์',
  535. 'home.blogs': 'บล็อก',
  536. 'home.blogsHint': 'บทความสมาร์ทฟาร์มมิ่งล่าสุด',
  537. 'home.profile': 'โปรไฟล์',
  538. 'home.profileHint': 'ข้อมูลฟาร์มและภาษา',
  539. 'home.count.tasks': 'งาน',
  540. 'home.count.history': 'ประวัติ',
  541. 'tasks.title': 'งานประจำวัน',
  542. 'tasks.subtitle': 'บันทึกงานประจำวันของแปลงวันนี้',
  543. 'tasks.loading': 'กำลังโหลดงาน...',
  544. 'tasks.empty': 'ยังไม่มีงานที่ตั้งไว้',
  545. 'tasks.pending': 'รอดำเนินการ',
  546. 'tasks.done': 'เสร็จแล้ว',
  547. 'tasks.complete': 'ทำเสร็จแล้ว',
  548. 'tasks.undo': 'ย้อนกลับ',
  549. 'tasks.notePlaceholder': 'เพิ่มบันทึกสำหรับวันนี้...',
  550. 'tasks.photo': 'รูปงาน',
  551. 'tasks.pickPhoto': 'เลือกรูป',
  552. 'tasks.takePhoto': 'ถ่ายรูป',
  553. 'tasks.cameraDenied': 'ไม่ได้รับอนุญาตให้ใช้กล้อง',
  554. 'tasks.cameraError': 'ไม่สามารถใช้งานกล้องได้',
  555. 'tasks.historyTitle': 'ประวัติงานประจำวัน',
  556. 'tasks.historyEmpty': 'ยังไม่มีประวัติงาน',
  557. 'tasks.back': 'กลับไปงานประจำวัน',
  558. 'tasks.default.fieldCheck': 'ตรวจแปลง',
  559. 'tasks.default.fieldCheckDesc': 'เช็คสภาพแปลงและบันทึกสั้น ๆ',
  560. 'tasks.default.scouting': 'สำรวจแมลง/โรค',
  561. 'tasks.default.scoutingDesc': 'ตรวจใบและบันทึกความรุนแรง',
  562. 'tasks.default.sensors': 'อ่านค่าจากเซนเซอร์',
  563. 'tasks.default.sensorsDesc': 'บันทึกความชื้นดินหรือสภาพอากาศ',
  564. 'fields.title': 'แปลง',
  565. 'fields.loading': 'กำลังโหลดแปลง...',
  566. 'fields.empty': 'ยังไม่มีแปลง',
  567. 'fields.nameRequired': 'ต้องระบุชื่อแปลง',
  568. 'fields.areaInvalid': 'พื้นที่ต้องเป็นตัวเลข',
  569. 'fields.saved': 'บันทึกแล้ว',
  570. 'fields.name': 'ชื่อแปลง',
  571. 'fields.area': 'พื้นที่ (ไร่)',
  572. 'fields.areaPlaceholder': 'เช่น 1.5',
  573. 'fields.notes': 'บันทึก',
  574. 'fields.notesPlaceholder': 'ดิน น้ำ จุดสังเกต...',
  575. 'fields.save': 'บันทึกแปลง',
  576. 'fields.update': 'อัปเดตแปลง',
  577. 'fields.cancel': 'ยกเลิก',
  578. 'fields.edit': 'แก้ไข',
  579. 'fields.delete': 'ลบ',
  580. 'fields.deleteTitle': 'ลบแปลงนี้ไหม?',
  581. 'fields.deleteMessage': 'การลบไม่สามารถย้อนกลับได้',
  582. 'fields.new': 'เพิ่มแปลง',
  583. 'fields.unnamed': 'แปลงไม่มีชื่อ',
  584. 'fields.areaLabel': 'พื้นที่:',
  585. 'fields.photo': 'รูปแปลง',
  586. 'fields.pickPhoto': 'เลือกรูป',
  587. 'fields.takePhoto': 'ถ่ายรูป',
  588. 'fields.noPhoto': 'ยังไม่ได้เลือกรูป',
  589. 'fields.updatedAt': 'อัปเดตเมื่อ:',
  590. 'logbook.title': 'บันทึก',
  591. 'logbook.subtitle': 'จัดการข้อมูลหลักของคุณ',
  592. 'logbook.fields': 'แปลง',
  593. 'logbook.fieldsHint': 'พื้นที่ บันทึก ขอบเขต',
  594. 'logbook.observations': 'บันทึกสำรวจ',
  595. 'logbook.observationsHint': 'บันทึกสำรวจและความรุนแรง',
  596. 'logbook.crops': 'พืช',
  597. 'logbook.cropsHint': 'ข้อมูลพืชตามแปลง',
  598. 'logbook.tasks': 'งานประจำวัน',
  599. 'logbook.tasksHint': 'บันทึก รูปภาพ สถานะ',
  600. 'logbook.history': 'ประวัติงาน',
  601. 'logbook.historyHint': 'รายการที่เสร็จแล้วตามวันที่',
  602. 'logbook.harvests': 'เก็บเกี่ยว',
  603. 'logbook.harvestsHint': 'ผลผลิตและรายละเอียดการเก็บเกี่ยว',
  604. 'logbook.sales': 'ขายผลผลิต',
  605. 'logbook.salesHint': 'บันทึกการขายและผู้ซื้อ',
  606. 'logbook.costs': 'ต้นทุน',
  607. 'logbook.costsHint': 'ค่าใช้จ่ายและใบเสร็จ',
  608. 'observations.title': 'บันทึกสำรวจ',
  609. 'observations.loading': 'กำลังโหลดบันทึก...',
  610. 'observations.empty': 'ยังไม่มีบันทึก',
  611. 'observations.saved': 'บันทึกแล้ว',
  612. 'observations.field': 'แปลง',
  613. 'observations.crop': 'พืช',
  614. 'observations.type': 'ประเภท',
  615. 'observations.note': 'บันทึก',
  616. 'observations.severity': 'ความรุนแรง',
  617. 'observations.severityLabel': 'ความรุนแรง:',
  618. 'observations.selectField': 'เลือกแปลง',
  619. 'observations.selectCrop': 'เลือกพืช',
  620. 'observations.typePlaceholder': 'เช่น สำรวจโรค',
  621. 'observations.notePlaceholder': 'สังเกตอะไรบ้าง?',
  622. 'observations.severityPlaceholder': '0-10',
  623. 'observations.fieldRequired': 'ต้องเลือกแปลง',
  624. 'observations.severityInvalid': 'ความรุนแรงต้องเป็นตัวเลข',
  625. 'observations.delete': 'ลบ',
  626. 'observations.noField': 'ไม่มีแปลง',
  627. 'observations.noCrop': 'ไม่มีพืช',
  628. 'observations.untitled': 'บันทึกสำรวจ',
  629. 'observations.save': 'บันทึกข้อมูล',
  630. 'observations.new': 'เพิ่มบันทึก',
  631. 'observations.cancel': 'ยกเลิก',
  632. 'observations.edit': 'แก้ไขบันทึก',
  633. 'observations.update': 'อัปเดตบันทึก',
  634. 'observations.photo': 'รูปประกอบ',
  635. 'observations.pickPhoto': 'เลือกรูป',
  636. 'observations.takePhoto': 'ถ่ายรูป',
  637. 'observations.noPhoto': 'ยังไม่ได้เลือกรูป',
  638. 'harvests.title': 'บันทึกการเก็บเกี่ยว',
  639. 'harvests.loading': 'กำลังโหลดการเก็บเกี่ยว...',
  640. 'harvests.empty': 'ยังไม่มีบันทึกการเก็บเกี่ยว',
  641. 'harvests.saved': 'บันทึกแล้ว',
  642. 'harvests.new': 'เพิ่มการเก็บเกี่ยว',
  643. 'harvests.field': 'แปลง',
  644. 'harvests.crop': 'พืช',
  645. 'harvests.selectField': 'เลือกแปลง',
  646. 'harvests.selectCrop': 'เลือกพืช',
  647. 'harvests.date': 'วันที่เก็บเกี่ยว',
  648. 'harvests.datePlaceholder': 'YYYY-MM-DD',
  649. 'harvests.quantity': 'ปริมาณ',
  650. 'harvests.quantityPlaceholder': 'เช่น 120',
  651. 'harvests.unit': 'หน่วย',
  652. 'harvests.unitPlaceholder': 'กก.',
  653. 'harvests.notes': 'บันทึก',
  654. 'harvests.notesPlaceholder': 'คุณภาพ สภาพอากาศ แรงงาน...',
  655. 'harvests.photo': 'รูปการเก็บเกี่ยว',
  656. 'harvests.pickPhoto': 'เลือกรูป',
  657. 'harvests.takePhoto': 'ถ่ายรูป',
  658. 'harvests.noPhoto': 'ยังไม่ได้เลือกรูป',
  659. 'harvests.fieldRequired': 'ต้องเลือกแปลง',
  660. 'harvests.cropRequired': 'ต้องเลือกพืช',
  661. 'harvests.quantityInvalid': 'ปริมาณต้องเป็นตัวเลข',
  662. 'harvests.delete': 'ลบ',
  663. 'harvests.deleteTitle': 'ลบบันทึกการเก็บเกี่ยว?',
  664. 'harvests.deleteMessage': 'การลบไม่สามารถย้อนกลับได้',
  665. 'harvests.cancel': 'ยกเลิก',
  666. 'harvests.save': 'บันทึกการเก็บเกี่ยว',
  667. 'harvests.untitled': 'เก็บเกี่ยว',
  668. 'harvests.noField': 'ไม่มีแปลง',
  669. 'harvests.noCrop': 'ไม่มีพืช',
  670. 'harvests.edit': 'แก้ไขการเก็บเกี่ยว',
  671. 'harvests.update': 'อัปเดตการเก็บเกี่ยว',
  672. 'sales.title': 'บันทึกการขาย',
  673. 'sales.loading': 'กำลังโหลดการขาย...',
  674. 'sales.empty': 'ยังไม่มีบันทึกการขาย',
  675. 'sales.saved': 'บันทึกแล้ว',
  676. 'sales.new': 'เพิ่มการขาย',
  677. 'sales.field': 'แปลง',
  678. 'sales.crop': 'พืช',
  679. 'sales.harvest': 'เก็บเกี่ยว (ไม่บังคับ)',
  680. 'sales.selectField': 'เลือกแปลง',
  681. 'sales.selectCrop': 'เลือกพืช',
  682. 'sales.selectHarvest': 'เลือกการเก็บเกี่ยว',
  683. 'sales.noHarvest': 'ยังไม่มีการเก็บเกี่ยว',
  684. 'sales.date': 'วันที่ขาย',
  685. 'sales.datePlaceholder': 'YYYY-MM-DD',
  686. 'sales.quantity': 'ปริมาณ',
  687. 'sales.quantityPlaceholder': 'เช่น 50',
  688. 'sales.unit': 'หน่วย',
  689. 'sales.unitPlaceholder': 'กก.',
  690. 'sales.price': 'ราคา',
  691. 'sales.pricePlaceholder': 'เช่น 35',
  692. 'sales.priceLabel': 'ราคา:',
  693. 'sales.buyer': 'ผู้ซื้อ',
  694. 'sales.buyerPlaceholder': 'เช่น ตลาดท้องถิ่น',
  695. 'sales.notes': 'บันทึก',
  696. 'sales.notesPlaceholder': 'การชำระเงิน ขนส่ง คุณภาพ...',
  697. 'sales.fieldRequired': 'ต้องเลือกแปลง',
  698. 'sales.cropRequired': 'ต้องเลือกพืช',
  699. 'sales.quantityInvalid': 'ปริมาณต้องเป็นตัวเลข',
  700. 'sales.delete': 'ลบ',
  701. 'sales.deleteTitle': 'ลบบันทึกการขาย?',
  702. 'sales.deleteMessage': 'การลบไม่สามารถย้อนกลับได้',
  703. 'sales.cancel': 'ยกเลิก',
  704. 'sales.save': 'บันทึกการขาย',
  705. 'sales.untitled': 'การขาย',
  706. 'sales.noField': 'ไม่มีแปลง',
  707. 'sales.noCrop': 'ไม่มีพืช',
  708. 'sales.edit': 'แก้ไขการขาย',
  709. 'sales.update': 'อัปเดตการขาย',
  710. 'costs.title': 'บันทึกต้นทุน',
  711. 'costs.loading': 'กำลังโหลดต้นทุน...',
  712. 'costs.empty': 'ยังไม่มีบันทึกต้นทุน',
  713. 'costs.saved': 'บันทึกแล้ว',
  714. 'costs.new': 'เพิ่มต้นทุน',
  715. 'costs.field': 'แปลง',
  716. 'costs.crop': 'พืช (ไม่บังคับ)',
  717. 'costs.selectField': 'เลือกแปลง',
  718. 'costs.selectCrop': 'เลือกพืช',
  719. 'costs.category': 'หมวดหมู่',
  720. 'costs.category.seed': 'เมล็ดพันธุ์',
  721. 'costs.category.fertilizer': 'ปุ๋ย',
  722. 'costs.category.labor': 'แรงงาน',
  723. 'costs.category.fuel': 'เชื้อเพลิง',
  724. 'costs.category.equipment': 'อุปกรณ์',
  725. 'costs.category.transport': 'ขนส่ง',
  726. 'costs.category.misc': 'อื่น ๆ',
  727. 'costs.categoryPlaceholder': 'เช่น เมล็ดพันธุ์',
  728. 'costs.amount': 'จำนวนเงิน',
  729. 'costs.amountPlaceholder': 'เช่น 1200',
  730. 'costs.vendor': 'ผู้ขาย',
  731. 'costs.vendorPlaceholder': 'เช่น ร้านวัสดุเกษตร',
  732. 'costs.date': 'วันที่',
  733. 'costs.datePlaceholder': 'YYYY-MM-DD',
  734. 'costs.notes': 'บันทึก',
  735. 'costs.notesPlaceholder': 'ใบเสร็จ การใช้งาน วัตถุประสงค์...',
  736. 'costs.photo': 'รูปใบเสร็จ',
  737. 'costs.pickPhoto': 'เลือกรูป',
  738. 'costs.takePhoto': 'ถ่ายรูป',
  739. 'costs.noPhoto': 'ยังไม่ได้เลือกรูป',
  740. 'costs.fieldRequired': 'ต้องเลือกแปลง',
  741. 'costs.amountInvalid': 'จำนวนเงินต้องเป็นตัวเลข',
  742. 'costs.delete': 'ลบ',
  743. 'costs.deleteTitle': 'ลบบันทึกต้นทุน?',
  744. 'costs.deleteMessage': 'การลบไม่สามารถย้อนกลับได้',
  745. 'costs.cancel': 'ยกเลิก',
  746. 'costs.save': 'บันทึกต้นทุน',
  747. 'costs.edit': 'แก้ไขต้นทุน',
  748. 'costs.update': 'อัปเดตต้นทุน',
  749. 'costs.untitled': 'ต้นทุน',
  750. 'costs.noField': 'ไม่มีแปลง',
  751. 'costs.noCrop': 'ไม่มีพืช',
  752. 'demo.field.north': 'แปลงเหนือ',
  753. 'demo.field.northNote': 'ดินร่วน · น้ำหยด',
  754. 'demo.field.river': 'แปลงริมน้ำ',
  755. 'demo.field.riverNote': 'พื้นที่ลุ่มใกล้คลอง',
  756. 'demo.field.greenhouse': 'โรงเรือน',
  757. 'demo.field.greenhouseNote': 'แปลงในร่ม รดน้ำทุกวัน',
  758. 'demo.field.orchard': 'แปลงสวนผลไม้',
  759. 'demo.field.orchardNote': 'ยกร่องและมีแนวกันลมด้านตะวันออก',
  760. 'demo.field.terrace': 'แปลงขั้นบันได',
  761. 'demo.field.terraceNote': 'พื้นที่ลาดชันแบ่งขั้น พร้อมน้ำหยด',
  762. 'demo.crop.tomato': 'มะเขือเทศ',
  763. 'demo.crop.tomatoVariety': 'เชอรี่',
  764. 'demo.crop.rice': 'ข้าว',
  765. 'demo.crop.riceVariety': 'หอมมะลิ',
  766. 'demo.crop.lettuce': 'ผักกาดหอม',
  767. 'demo.crop.lettuceVariety': 'บัตเตอร์เฮด',
  768. 'demo.crop.chili': 'พริก',
  769. 'demo.crop.chiliVariety': 'พริกขี้หนู',
  770. 'demo.crop.cabbage': 'กะหล่ำปลี',
  771. 'demo.crop.cabbageVariety': 'กะหล่ำปลีเขียว',
  772. 'demo.observation.scoutingNote': 'พบบางส่วนใบเป็นจุดเริ่มต้นตามขอบแปลง',
  773. 'demo.observation.diseaseNote': 'พบรอยโรคหลังฝนตก',
  774. 'demo.observation.irrigationNote': 'ปรับเวลารดน้ำเป็นช่วงเย็น',
  775. 'demo.observation.pestNote': 'พบเพลี้ยอ่อนตามยอดอ่อน',
  776. 'demo.observation.nutrientNote': 'ใบล่างซีด ให้ปุ๋ยทางใบเพิ่ม',
  777. 'demo.task.note': 'ทำงานเสร็จตามแผน',
  778. 'demo.task.note2': 'ทำตามเช็กลิสต์มาตรฐาน',
  779. 'demo.task.note3': 'ตรวจอุปกรณ์และบันทึกค่าแล้ว',
  780. 'demo.harvest.note1': 'เก็บช่วงเช้า คุณภาพดี',
  781. 'demo.harvest.note2': 'เก็บหลังฝนตกเล็กน้อย',
  782. 'demo.harvest.note3': 'คัดขนาดเพื่อขาย',
  783. 'demo.sale.buyer1': 'ตลาดท้องถิ่น',
  784. 'demo.sale.buyer2': 'ผู้ซื้อส่ง',
  785. 'demo.sale.buyer3': 'คู่ค้าร้านอาหาร',
  786. 'demo.sale.note1': 'ส่งของในวันเดียวกัน',
  787. 'demo.sale.note2': 'ชำระเงินครบถ้วน',
  788. 'demo.sale.note3': 'ขอสั่งประจำทุกสัปดาห์',
  789. 'demo.cost.vendor1': 'ร้านวัสดุเกษตร',
  790. 'demo.cost.vendor2': 'ร้านปุ๋ย',
  791. 'demo.cost.vendor3': 'ทีมแรงงาน',
  792. 'demo.cost.note1': 'เมล็ดมะเขือเทศและถาดเพาะ',
  793. 'demo.cost.note2': 'ปุ๋ยรองพื้นแปลงข้าว',
  794. 'demo.cost.note3': 'แรงงานช่วยเก็บเกี่ยว (ครึ่งวัน)',
  795. 'observations.type.scouting': 'สำรวจ',
  796. 'observations.type.pest': 'แมลง',
  797. 'observations.type.disease': 'โรค',
  798. 'observations.type.irrigation': 'ให้น้ำ',
  799. 'observations.type.weeds': 'วัชพืช',
  800. 'observations.type.nutrients': 'ธาตุอาหาร',
  801. 'crops.title': 'พืช',
  802. 'crops.loading': 'กำลังโหลดพืช...',
  803. 'crops.empty': 'ยังไม่มีพืช',
  804. 'crops.saved': 'บันทึกแล้ว',
  805. 'crops.field': 'แปลง',
  806. 'crops.selectField': 'เลือกแปลง',
  807. 'crops.name': 'ชื่อพืช',
  808. 'crops.variety': 'สายพันธุ์',
  809. 'crops.planting': 'วันที่ปลูก',
  810. 'crops.harvest': 'คาดว่าจะเก็บเกี่ยว',
  811. 'crops.namePlaceholder': 'เช่น มะเขือเทศ',
  812. 'crops.varietyPlaceholder': 'เช่น เชอรี่',
  813. 'crops.plantingPlaceholder': 'YYYY-MM-DD',
  814. 'crops.harvestPlaceholder': 'YYYY-MM-DD',
  815. 'crops.fieldRequired': 'ต้องเลือกแปลง',
  816. 'crops.nameRequired': 'ต้องกรอกชื่อพืช',
  817. 'crops.delete': 'ลบ',
  818. 'crops.deleteTitle': 'ลบพืชนี้ไหม?',
  819. 'crops.deleteMessage': 'การลบไม่สามารถย้อนกลับได้',
  820. 'crops.noField': 'ไม่มีแปลง',
  821. 'crops.untitled': 'พืช',
  822. 'crops.plantingLabel': 'ปลูก:',
  823. 'crops.harvestLabel': 'เก็บเกี่ยว:',
  824. 'crops.save': 'บันทึกพืช',
  825. 'crops.new': 'เพิ่มพืช',
  826. 'crops.photo': 'รูปพืช',
  827. 'crops.pickPhoto': 'เลือกรูป',
  828. 'crops.takePhoto': 'ถ่ายรูป',
  829. 'crops.noPhoto': 'ยังไม่ได้เลือกรูป',
  830. 'crops.today': 'วันนี้',
  831. 'crops.done': 'เสร็จ',
  832. 'crops.edit': 'แก้ไขพืช',
  833. 'crops.update': 'อัปเดตพืช',
  834. 'crops.cancel': 'ยกเลิก',
  835. },
  836. };
  837. function getDeviceLanguage(): Language {
  838. try {
  839. const locale = Intl.DateTimeFormat().resolvedOptions().locale;
  840. if (locale.toLowerCase().startsWith('th')) return 'th';
  841. } catch {
  842. // fall through
  843. }
  844. return 'en';
  845. }
  846. type LocalizationContextValue = {
  847. language: Language;
  848. setLanguage: (language: Language) => void;
  849. t: (key: string, params?: Params) => string;
  850. };
  851. const LocalizationContext = createContext<LocalizationContextValue | null>(null);
  852. export function LocalizationProvider({ children }: { children: ReactNode }) {
  853. const [language, setLanguage] = useState<Language>(getDeviceLanguage());
  854. const t = useCallback(
  855. (key: string, params?: Params) => {
  856. const template = strings[language][key] ?? strings.en[key] ?? key;
  857. if (!params) return template;
  858. return Object.keys(params).reduce((result, paramKey) => {
  859. return result.replace(
  860. new RegExp(`{{${paramKey}}}`, 'g'),
  861. String(params[paramKey])
  862. );
  863. }, template);
  864. },
  865. [language]
  866. );
  867. const value = useMemo(
  868. () => ({ language, setLanguage, t }),
  869. [language, setLanguage, t]
  870. );
  871. return <LocalizationContext.Provider value={value}>{children}</LocalizationContext.Provider>;
  872. }
  873. export function useTranslation() {
  874. const ctx = useContext(LocalizationContext);
  875. if (!ctx) {
  876. throw new Error('useTranslation must be used within LocalizationProvider');
  877. }
  878. return ctx;
  879. }