@gram-lang/i18n 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -34,6 +34,15 @@ declare const UNIT_CONVERSIONS: {
34
34
  * Examples: 'càs' -> 'tbsp', 'kilo' -> 'kg'.
35
35
  */
36
36
  declare function normalizeUnit(rawUnit: string | undefined | null, lang?: string): string;
37
+ /**
38
+ * True for a mass/volume unit at or above its category's base unit (g, kg,
39
+ * oz, lb, ml, cl, dl, l, tsp, tbsp, cup, ...) — the kind of unit a cook
40
+ * measures with a scale or a spoon, not a lab balance. Callers use this to
41
+ * decide when a quantity should be rounded coarser for display than the
42
+ * precision it's stored at. Sub-base units (mg, drop, smidgen, pinch, dash)
43
+ * return false since their values are already small.
44
+ */
45
+ declare function isCoarseUnit(rawUnit: string | undefined | null): boolean;
37
46
 
38
47
  declare function getAiLanguageInstruction(lang?: string): string;
39
48
 
@@ -102,6 +111,7 @@ declare const en: {
102
111
  purchasingWeight: string;
103
112
  gross: string;
104
113
  intermediateResult: string;
114
+ moduleFrom: string;
105
115
  estimatedSuffix: string;
106
116
  missingMass: string;
107
117
  someIngredients: string;
@@ -183,16 +193,43 @@ declare const en: {
183
193
  massDesc: string;
184
194
  yieldManagement: string;
185
195
  nutrition: string;
196
+ stockTitle: string;
197
+ stockDesc: string;
186
198
  };
187
199
  output: {
188
200
  copy: string;
189
201
  loading: string;
190
202
  };
191
203
  warnings: {
204
+ consoleTitle: string;
205
+ errors: string;
206
+ error: string;
192
207
  warnings: string;
193
208
  warning: string;
209
+ infos: string;
210
+ info: string;
194
211
  item: string;
195
212
  show: string;
213
+ expandConsole: string;
214
+ collapseConsole: string;
215
+ };
216
+ errorState: {
217
+ title: string;
218
+ blockingDescription: string;
219
+ jumpToError: string;
220
+ line: string;
221
+ };
222
+ tabs: {
223
+ addFile: string;
224
+ removeFile: string;
225
+ renameFile: string;
226
+ entryFile: string;
227
+ newFileName: string;
228
+ previewingStandalone: string;
229
+ };
230
+ mobileTabs: {
231
+ editor: string;
232
+ preview: string;
196
233
  };
197
234
  analysisOptions: string;
198
235
  analysis: string;
@@ -208,4 +245,4 @@ type GramLocale = typeof en;
208
245
 
209
246
  declare function getDictionary(lang?: string): GramLocale;
210
247
 
211
- export { CATEGORY_KEYS, type CategoryKey, type CompiledDict, type GramLocale, type LanguageDict, TIME_BY_LANG, TIME_DICTIONARIES, TIME_GLOBAL, TIME_TO_MINUTES, UNIT_BY_LANG, UNIT_CONVERSIONS, UNIT_DICTIONARIES, UNIT_GLOBAL, type UnitMap, compileDictionary, getAiLanguageInstruction, getCategoryLabels, getDefaultCategories, getDictionary, isCategoryKey, normalizeUnit, resolveTimeUnit };
248
+ export { CATEGORY_KEYS, type CategoryKey, type CompiledDict, type GramLocale, type LanguageDict, TIME_BY_LANG, TIME_DICTIONARIES, TIME_GLOBAL, TIME_TO_MINUTES, UNIT_BY_LANG, UNIT_CONVERSIONS, UNIT_DICTIONARIES, UNIT_GLOBAL, type UnitMap, compileDictionary, getAiLanguageInstruction, getCategoryLabels, getDefaultCategories, getDictionary, isCategoryKey, isCoarseUnit, normalizeUnit, resolveTimeUnit };
package/dist/index.js CHANGED
@@ -184,6 +184,15 @@ function normalizeUnit(rawUnit, lang) {
184
184
  }
185
185
  return UNIT_GLOBAL[clean] || clean;
186
186
  }
187
+ function isCoarseUnit(rawUnit) {
188
+ const normalized = normalizeUnit(rawUnit);
189
+ if (!normalized) return false;
190
+ for (const category of [UNIT_CONVERSIONS.mass, UNIT_CONVERSIONS.volume]) {
191
+ const factor = category.map[normalized];
192
+ if (factor !== void 0) return factor >= 1;
193
+ }
194
+ return false;
195
+ }
187
196
 
188
197
  // src/ai.ts
189
198
  var LANGUAGE_NAMES = {
@@ -314,6 +323,7 @@ var en3 = {
314
323
  purchasingWeight: "Purchasing Weight (including waste/peel)",
315
324
  gross: "gross",
316
325
  intermediateResult: "Intermediate result for this section",
326
+ moduleFrom: "From this module",
317
327
  estimatedSuffix: " (Estimated)",
318
328
  missingMass: " (Missing: ",
319
329
  someIngredients: "some ingredients",
@@ -406,17 +416,44 @@ var en3 = {
406
416
  massStandardization: "Mass Standardization",
407
417
  massDesc: "Converts all ingredient quantities into grams.",
408
418
  yieldManagement: "Yield Management",
409
- nutrition: "Nutrition Estimation"
419
+ nutrition: "Nutrition Estimation",
420
+ stockTitle: "Stock (skip steps)",
421
+ stockDesc: "Treat as already on hand \u2014 collapses to one shopping-list line, no timeline steps."
410
422
  },
411
423
  output: {
412
424
  copy: "Copy to clipboard",
413
425
  loading: "Loading viewer..."
414
426
  },
415
427
  warnings: {
428
+ consoleTitle: "Diagnostics & Debug",
429
+ errors: "Errors",
430
+ error: "Error",
416
431
  warnings: "Warnings",
417
432
  warning: "Warning",
433
+ infos: "Notices",
434
+ info: "Notice",
418
435
  item: "Item",
419
- show: "Show"
436
+ show: "Show",
437
+ expandConsole: "Expand console",
438
+ collapseConsole: "Collapse console"
439
+ },
440
+ errorState: {
441
+ title: "Generation paused",
442
+ blockingDescription: "The recipe contains blocking errors preventing preview generation.",
443
+ jumpToError: "Jump to error",
444
+ line: "Line"
445
+ },
446
+ tabs: {
447
+ addFile: "Add file",
448
+ removeFile: "Remove file",
449
+ renameFile: "Rename file",
450
+ entryFile: "Entry",
451
+ newFileName: "New file name",
452
+ previewingStandalone: "Standalone preview of"
453
+ },
454
+ mobileTabs: {
455
+ editor: "Editor",
456
+ preview: "Preview"
420
457
  },
421
458
  analysisOptions: "Analysis Options",
422
459
  analysis: "Analysis",
@@ -476,6 +513,7 @@ var fr3 = {
476
513
  purchasingWeight: "Poids d'achat (incluant d\xE9chets/\xE9pluchures)",
477
514
  gross: "brut",
478
515
  intermediateResult: "R\xE9sultat interm\xE9diaire pour cette section",
516
+ moduleFrom: "Depuis ce module",
479
517
  estimatedSuffix: " (Estim\xE9)",
480
518
  missingMass: " (Manquant : ",
481
519
  someIngredients: "certains ingr\xE9dients",
@@ -556,17 +594,44 @@ var fr3 = {
556
594
  massStandardization: "Standardisation des masses",
557
595
  massDesc: "Convertit toutes les quantit\xE9s d'ingr\xE9dients en grammes.",
558
596
  yieldManagement: "Gestion du rendement",
559
- nutrition: "Estimation nutritionnelle"
597
+ nutrition: "Estimation nutritionnelle",
598
+ stockTitle: "En stock (masquer les \xE9tapes)",
599
+ stockDesc: "Consid\xE9r\xE9 comme d\xE9j\xE0 disponible \u2014 se r\xE9duit \xE0 une ligne d'achat, sans \xE9tapes sur la frise."
560
600
  },
561
601
  output: {
562
602
  copy: "Copier dans le presse-papier",
563
603
  loading: "Chargement du lecteur..."
564
604
  },
565
605
  warnings: {
606
+ consoleTitle: "Diagnostics & D\xE9bogage",
607
+ errors: "Erreurs",
608
+ error: "Erreur",
566
609
  warnings: "Avertissements",
567
610
  warning: "Avertissement",
611
+ infos: "Informations",
612
+ info: "Information",
568
613
  item: "\xC9l\xE9ment",
569
- show: "Afficher"
614
+ show: "Afficher",
615
+ expandConsole: "D\xE9velopper la console",
616
+ collapseConsole: "R\xE9duire la console"
617
+ },
618
+ errorState: {
619
+ title: "G\xE9n\xE9ration interrompue",
620
+ blockingDescription: "La recette contient des erreurs bloquantes emp\xEAchant la g\xE9n\xE9ration de l'aper\xE7u.",
621
+ jumpToError: "Aller \xE0 l'erreur",
622
+ line: "Ligne"
623
+ },
624
+ tabs: {
625
+ addFile: "Ajouter un fichier",
626
+ removeFile: "Supprimer le fichier",
627
+ renameFile: "Renommer le fichier",
628
+ entryFile: "Entr\xE9e",
629
+ newFileName: "Nom du nouveau fichier",
630
+ previewingStandalone: "Aper\xE7u isol\xE9 de"
631
+ },
632
+ mobileTabs: {
633
+ editor: "\xC9diteur",
634
+ preview: "Aper\xE7u"
570
635
  },
571
636
  analysisOptions: "Options d'Analyse",
572
637
  analysis: "Analyse",
@@ -605,6 +670,7 @@ export {
605
670
  getDefaultCategories,
606
671
  getDictionary,
607
672
  isCategoryKey,
673
+ isCoarseUnit,
608
674
  normalizeUnit,
609
675
  resolveTimeUnit
610
676
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gram-lang/i18n",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Gram recipe i18n and unit normalization logic",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm --dts --tsconfig ../../tsconfig.build.json",
33
33
  "typecheck": "tsc --noEmit",
34
- "test": "bun test",
34
+ "test": "bun test --only-failures",
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "type": "module"