@jjlmoya/utils-nature 1.1.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.
Files changed (61) hide show
  1. package/package.json +60 -0
  2. package/src/category/i18n/en.ts +110 -0
  3. package/src/category/i18n/es.ts +127 -0
  4. package/src/category/i18n/fr.ts +110 -0
  5. package/src/category/index.ts +14 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +30 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +146 -0
  14. package/src/pages/[locale].astro +251 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/faq_count.test.ts +19 -0
  17. package/src/tests/locale_completeness.test.ts +42 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/no_h1_in_components.test.ts +48 -0
  20. package/src/tests/schemas_fulfillment.test.ts +23 -0
  21. package/src/tests/seo_length.test.ts +22 -0
  22. package/src/tests/title_quality.test.ts +55 -0
  23. package/src/tests/tool_validation.test.ts +17 -0
  24. package/src/tool/cricketThermometer/bibliography.astro +14 -0
  25. package/src/tool/cricketThermometer/component.astro +549 -0
  26. package/src/tool/cricketThermometer/i18n/en.ts +181 -0
  27. package/src/tool/cricketThermometer/i18n/es.ts +181 -0
  28. package/src/tool/cricketThermometer/i18n/fr.ts +181 -0
  29. package/src/tool/cricketThermometer/index.ts +34 -0
  30. package/src/tool/cricketThermometer/logic.ts +6 -0
  31. package/src/tool/cricketThermometer/seo.astro +15 -0
  32. package/src/tool/cricketThermometer/ui.ts +11 -0
  33. package/src/tool/digitalCarbon/bibliography.astro +9 -0
  34. package/src/tool/digitalCarbon/component.astro +582 -0
  35. package/src/tool/digitalCarbon/i18n/en.ts +235 -0
  36. package/src/tool/digitalCarbon/i18n/es.ts +235 -0
  37. package/src/tool/digitalCarbon/i18n/fr.ts +235 -0
  38. package/src/tool/digitalCarbon/index.ts +33 -0
  39. package/src/tool/digitalCarbon/logic.ts +107 -0
  40. package/src/tool/digitalCarbon/seo.astro +14 -0
  41. package/src/tool/digitalCarbon/ui.ts +38 -0
  42. package/src/tool/rainHarvester/bibliography.astro +9 -0
  43. package/src/tool/rainHarvester/component.astro +559 -0
  44. package/src/tool/rainHarvester/i18n/en.ts +185 -0
  45. package/src/tool/rainHarvester/i18n/es.ts +185 -0
  46. package/src/tool/rainHarvester/i18n/fr.ts +185 -0
  47. package/src/tool/rainHarvester/index.ts +33 -0
  48. package/src/tool/rainHarvester/logic.ts +12 -0
  49. package/src/tool/rainHarvester/seo.astro +14 -0
  50. package/src/tool/rainHarvester/ui.ts +23 -0
  51. package/src/tool/seedCalculator/bibliography.astro +8 -0
  52. package/src/tool/seedCalculator/component.astro +812 -0
  53. package/src/tool/seedCalculator/i18n/en.ts +213 -0
  54. package/src/tool/seedCalculator/i18n/es.ts +213 -0
  55. package/src/tool/seedCalculator/i18n/fr.ts +213 -0
  56. package/src/tool/seedCalculator/index.ts +34 -0
  57. package/src/tool/seedCalculator/logic.ts +19 -0
  58. package/src/tool/seedCalculator/seo.astro +9 -0
  59. package/src/tool/seedCalculator/ui.ts +39 -0
  60. package/src/tools.ts +12 -0
  61. package/src/types.ts +72 -0
@@ -0,0 +1,181 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { CricketThermometerUI } from '../ui';
4
+
5
+ const slug = 'cricket-thermometer';
6
+ const title = 'Cricket Thermometer – Dolbear\'s Law Temperature Calculator';
7
+ const description =
8
+ 'No thermometer? Listen to the crickets. Calculate the exact temperature by counting chirps with our Dolbear\'s Law calculator.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: 'What is Dolbear\'s Law?',
13
+ answer:
14
+ 'Formulated in 1897 by Amos Dolbear, it is a scientific observation that discovered a linear correlation between the chirping rate of crickets and the ambient air temperature.',
15
+ },
16
+ {
17
+ question: 'Why do crickets chirp faster in the heat?',
18
+ answer:
19
+ 'Crickets are cold-blooded animals (ectotherms). The speed of their metabolic processes and muscle contractions depends on external temperature; the warmer it is, the more energy they have to emit sounds rapidly.',
20
+ },
21
+ {
22
+ question: 'Is this measurement accurate?',
23
+ answer:
24
+ 'It is surprisingly accurate for species like the snow tree cricket (Oecanthus fultoni), with a margin of error of about 0.5°C if counted correctly. However, factors such as humidity or wind can alter the result.',
25
+ },
26
+ {
27
+ question: 'Which cricket should I use for the calculation?',
28
+ answer:
29
+ 'The original formula is based on the snow tree cricket. For the common field cricket, the relationship is similar but the rate tends to be slightly slower.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Find a solitary cricket',
36
+ text: 'Find a quiet place at night where you can clearly hear the chirping of a single cricket to avoid confusing the rhythms.',
37
+ },
38
+ {
39
+ name: 'Count chirps for 15 seconds',
40
+ text: 'Use a stopwatch and count how many stridulations the insect emits in exactly 15 seconds.',
41
+ },
42
+ {
43
+ name: 'Enter the value',
44
+ text: 'Tap the TAP button in rhythm with the chirps for a few seconds so the calculator automatically computes the BPM.',
45
+ },
46
+ {
47
+ name: 'Verify the temperature',
48
+ text: 'The system will apply the formula T(°C) = 10 + (N - 40) / 7 to give you an estimate of the ambient heat in degrees Celsius.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowToThing> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step, i) => ({
68
+ '@type': 'HowToStep',
69
+ position: i + 1,
70
+ name: step.name,
71
+ text: step.text,
72
+ })),
73
+ };
74
+
75
+ const appSchema: WithContext<SoftwareApplication> = {
76
+ '@context': 'https://schema.org',
77
+ '@type': 'SoftwareApplication',
78
+ name: title,
79
+ description,
80
+ applicationCategory: 'UtilityApplication',
81
+ operatingSystem: 'All',
82
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
83
+ inLanguage: 'en',
84
+ };
85
+
86
+ export const content: ToolLocaleContent<CricketThermometerUI> = {
87
+ slug,
88
+ title,
89
+ description,
90
+ faqTitle: 'Frequently Asked Questions',
91
+ faq: faqData,
92
+ bibliographyTitle: 'Scientific References',
93
+ bibliography: [
94
+ {
95
+ name: 'The American Naturalist - The Cricket as a Thermometer',
96
+ url: 'https://www.jstor.org/stable/2453256',
97
+ },
98
+ {
99
+ name: 'Wikipedia - Dolbear\'s Law',
100
+ url: 'https://en.wikipedia.org/wiki/Dolbear%27s_law',
101
+ },
102
+ ],
103
+ howTo: howToData,
104
+ schemas: [faqSchema, howToSchema, appSchema],
105
+ seo: [
106
+ {
107
+ type: 'title',
108
+ text: 'Complete Guide: How to Use Dolbear\'s Law to Calculate Temperature',
109
+ level: 2,
110
+ },
111
+ {
112
+ type: 'paragraph',
113
+ html: 'Did you know you can tell the exact temperature just by listening to nature? In 1897, physicist Amos Dolbear discovered a precise mathematical relationship between the rate of cricket chirps and the ambient heat. This tool digitalizes that discovery to turn your phone into a natural thermometer.',
114
+ },
115
+ {
116
+ type: 'tip',
117
+ title: 'Why do crickets sing?',
118
+ html: '<p>The cricket\'s "song", or <strong>stridulation</strong>, is actually a mating call. Males rub their wings (not their legs) together to create this sound. Fascinatingly, since they are cold-blooded animals (ectotherms), the speed of this rubbing depends directly on the thermal energy of the air.</p>',
119
+ },
120
+ {
121
+ type: 'title',
122
+ text: 'The Science: Ectothermy and Metabolism',
123
+ level: 3,
124
+ },
125
+ {
126
+ type: 'paragraph',
127
+ html: 'Unlike mammals, which maintain a constant body temperature, insects depend on external heat. Their biochemical reactions follow the <strong>Arrhenius Equation</strong>: the more heat, the faster the reaction.',
128
+ },
129
+ {
130
+ type: 'paragraph',
131
+ html: 'This means that for the cricket\'s muscles to contract and rub its wings, they need enzymatic reactions. If it\'s cold, these reactions are slow and the chirp is sluggish. If it\'s warm, metabolism speeds up and the song becomes a frantic trill.',
132
+ },
133
+ {
134
+ type: 'title',
135
+ text: 'Dolbear\'s Formula',
136
+ level: 3,
137
+ },
138
+ {
139
+ type: 'paragraph',
140
+ html: 'Although variations exist for different species, the most famous formula is for the snow tree cricket (<em>Oecanthus fultoni</em>). To obtain the temperature in degrees Celsius:',
141
+ },
142
+ {
143
+ type: 'code',
144
+ code: 'T(°C) = 10 + (N - 40) / 7\n\nWhere N = number of chirps per minute.',
145
+ ariaLabel: 'Dolbear\'s formula for calculating temperature from cricket chirps',
146
+ },
147
+ {
148
+ type: 'paragraph',
149
+ html: 'Our tool does this automatically: it measures the time between your taps, calculates chirps per minute (BPM) and applies the formula instantly.',
150
+ },
151
+ {
152
+ type: 'title',
153
+ text: 'Fascinating Facts',
154
+ level: 3,
155
+ },
156
+ {
157
+ type: 'list',
158
+ items: [
159
+ '<strong>Thermometers of Love:</strong> Some theories suggest that females prefer males who sing at the "correct" frequency for the current temperature, as it indicates the male is healthy and has a strong metabolism.',
160
+ '<strong>Cold Limit:</strong> Below 10°C (50°F), most crickets stop singing because their metabolism is too slow to sustain the muscular effort.',
161
+ '<strong>Synchronization:</strong> On warm nights, thousands of crickets can synchronize their chirps, creating an impressive "wave" sound effect.',
162
+ ],
163
+ },
164
+ {
165
+ type: 'tip',
166
+ title: 'Accuracy Note',
167
+ html: '<p>Accuracy depends on the cricket species. This tool is calibrated for the common field cricket and tree cricket. Factors such as humidity or wind can alter the result by ±0.5°C.</p>',
168
+ },
169
+ ],
170
+ ui: {
171
+ labelWaiting: 'Waiting...',
172
+ labelTapping: 'Keep tapping...',
173
+ tapInstruction: 'Every time you hear a chirp',
174
+ btnReset: 'Reset',
175
+ btnSoundOn: 'Sound: On',
176
+ btnSoundOff: 'Sound: Off',
177
+ unitChirpsMin: 'chirps/min',
178
+ faqTitle: 'Frequently Asked Questions',
179
+ bibliographyTitle: 'Scientific References',
180
+ },
181
+ };
@@ -0,0 +1,181 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { CricketThermometerUI } from '../ui';
4
+
5
+ const slug = 'termometro-grillo';
6
+ const title = '¿Qué temperatura hace? – Termómetro de Grillos (Ley de Dolbear)';
7
+ const description =
8
+ '¿No tienes termómetro? Escucha a los grillos. Calcula la temperatura exacta contando sus chirridos con nuestra calculadora de la Ley de Dolbear.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: '¿Qué es la Ley de Dolbear?',
13
+ answer:
14
+ 'Formulada en 1897 por Amos Dolbear, es una observación científica que descubrió una correlación lineal entre el ritmo de los chirridos de un grillo y la temperatura ambiente del aire.',
15
+ },
16
+ {
17
+ question: '¿Por qué los grillos chirrían más rápido con el calor?',
18
+ answer:
19
+ 'Los grillos son animales de sangre fría (ectotermos). La velocidad de sus procesos metabólicos y contracciones musculares depende de la temperatura externa; a más calor, más energía tienen para emitir sonidos rápidamente.',
20
+ },
21
+ {
22
+ question: '¿Es precisa esta medición?',
23
+ answer:
24
+ 'Es sorprendentemente precisa para especies como el grillo del árbol (Oecanthus fultoni), con un margen de error de unos 0.5°C si se cuenta correctamente. Sin embargo, factores como la humedad o el viento pueden alterar el resultado.',
25
+ },
26
+ {
27
+ question: '¿Qué grillo debo usar para el cálculo?',
28
+ answer:
29
+ 'La fórmula original está basada en el grillo del árbol nevado. Para el grillo común de campo, la relación es similar pero el ritmo suele ser ligeramente más lento.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Localizar un grillo solitario',
36
+ text: 'Busca un lugar tranquilo por la noche donde puedas escuchar el chirrido de un solo grillo con claridad para no confundir los ritmos.',
37
+ },
38
+ {
39
+ name: 'Contar chirridos en 15 segundos',
40
+ text: 'Usa un cronómetro y cuenta cuántas estridulaciones emite el insecto en exactamente 15 segundos.',
41
+ },
42
+ {
43
+ name: 'Introducir el valor',
44
+ text: 'Pulsa el botón TAP al ritmo de los chirridos durante unos segundos para que la calculadora calcule el BPM automáticamente.',
45
+ },
46
+ {
47
+ name: 'Verificar la temperatura',
48
+ text: 'El sistema aplicará la fórmula T(°C) = 10 + (N - 40) / 7 para darte una estimación del calor ambiental en grados Celsius.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowToThing> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step, i) => ({
68
+ '@type': 'HowToStep',
69
+ position: i + 1,
70
+ name: step.name,
71
+ text: step.text,
72
+ })),
73
+ };
74
+
75
+ const appSchema: WithContext<SoftwareApplication> = {
76
+ '@context': 'https://schema.org',
77
+ '@type': 'SoftwareApplication',
78
+ name: title,
79
+ description,
80
+ applicationCategory: 'UtilityApplication',
81
+ operatingSystem: 'All',
82
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
83
+ inLanguage: 'es',
84
+ };
85
+
86
+ export const content: ToolLocaleContent<CricketThermometerUI> = {
87
+ slug,
88
+ title,
89
+ description,
90
+ faqTitle: 'Preguntas Frecuentes',
91
+ faq: faqData,
92
+ bibliographyTitle: 'Referencias Científicas',
93
+ bibliography: [
94
+ {
95
+ name: 'The American Naturalist - The Cricket as a Thermometer',
96
+ url: 'https://www.jstor.org/stable/2453256',
97
+ },
98
+ {
99
+ name: 'Wikipedia - Dolbear\'s Law',
100
+ url: 'https://en.wikipedia.org/wiki/Dolbear%27s_law',
101
+ },
102
+ ],
103
+ howTo: howToData,
104
+ schemas: [faqSchema, howToSchema, appSchema],
105
+ seo: [
106
+ {
107
+ type: 'title',
108
+ text: 'Guía Completa: Cómo Usar la Ley de Dolbear para Calcular la Temperatura',
109
+ level: 2,
110
+ },
111
+ {
112
+ type: 'paragraph',
113
+ html: '¿Sabías que puedes saber la temperatura exacta solo escuchando a la naturaleza? En 1897, el físico Amos Dolbear descubrió una relación matemática precisa entre el ritmo de los grillos y el calor ambiente. Esta herramienta digitaliza ese descubrimiento para convertir tu móvil en un termómetro natural.',
114
+ },
115
+ {
116
+ type: 'tip',
117
+ title: '¿Por qué cantan los grillos?',
118
+ html: '<p>El "canto" del grillo, o <strong>estridulación</strong>, es en realidad un llamado de apareamiento. Los machos frotan sus alas (no sus patas) para crear este sonido. Lo fascinante es que, al ser animales de sangre fría (ectotermos), la velocidad de este frotamiento depende directamente de la energía térmica del aire.</p>',
119
+ },
120
+ {
121
+ type: 'title',
122
+ text: 'La Ciencia: Ectotermia y Metabolismo',
123
+ level: 3,
124
+ },
125
+ {
126
+ type: 'paragraph',
127
+ html: 'A diferencia de los mamíferos, que mantenemos nuestra temperatura corporal constante, los insectos dependen del calor externo. Sus reacciones bioquímicas siguen la <strong>Ecuación de Arrhenius</strong>: cuanto más calor, más rápida es la reacción.',
128
+ },
129
+ {
130
+ type: 'paragraph',
131
+ html: 'Esto significa que para que los músculos del grillo se contraigan y froten sus alas, necesitan reacciones enzimáticas. Si hace frío, estas reacciones son lentas y el canto es pausado. Si hace calor, el metabolismo se acelera y el canto se vuelve un trino frenético.',
132
+ },
133
+ {
134
+ type: 'title',
135
+ text: 'La Fórmula de Dolbear',
136
+ level: 3,
137
+ },
138
+ {
139
+ type: 'paragraph',
140
+ html: 'Aunque existen variaciones para diferentes especies, la fórmula más famosa es la del grillo del árbol nevado (<em>Oecanthus fultoni</em>). Para obtener la temperatura en grados Celsius:',
141
+ },
142
+ {
143
+ type: 'code',
144
+ code: 'T(°C) = 10 + (N - 40) / 7\n\nDonde N = número de chirridos por minuto.',
145
+ ariaLabel: 'Fórmula de Dolbear para calcular temperatura a partir de chirridos de grillo',
146
+ },
147
+ {
148
+ type: 'paragraph',
149
+ html: 'Nuestra herramienta hace esto automáticamente: mide el tiempo entre tus toques, calcula los chirridos por minuto (BPM) y aplica la fórmula instantáneamente.',
150
+ },
151
+ {
152
+ type: 'title',
153
+ text: 'Curiosidades Fascinantes',
154
+ level: 3,
155
+ },
156
+ {
157
+ type: 'list',
158
+ items: [
159
+ '<strong>Termómetros del Amor:</strong> Algunas teorías sugieren que las hembras prefieren machos que cantan a la frecuencia "correcta" para la temperatura actual, ya que indica que el macho está sano y tiene un metabolismo fuerte.',
160
+ '<strong>Límite de Frío:</strong> Por debajo de los 10°C (50°F), la mayoría de los grillos dejan de cantar porque su metabolismo es demasiado lento para sostener el esfuerzo muscular.',
161
+ '<strong>Sincronización:</strong> En noches cálidas, miles de grillos pueden llegar a sincronizar sus chirridos, creando un efecto de "ola" sonora impresionante.',
162
+ ],
163
+ },
164
+ {
165
+ type: 'tip',
166
+ title: 'Nota de Precisión',
167
+ html: '<p>La precisión depende de la especie de grillo. Esta herramienta está calibrada para el grillo de campo común y el grillo de árbol. Factores como la humedad o el viento pueden alterar el resultado en ±0.5°C.</p>',
168
+ },
169
+ ],
170
+ ui: {
171
+ labelWaiting: 'Esperando...',
172
+ labelTapping: 'Sigue pulsando...',
173
+ tapInstruction: 'Cada vez que oigas un chirrido',
174
+ btnReset: 'Reiniciar',
175
+ btnSoundOn: 'Sonido: On',
176
+ btnSoundOff: 'Sonido: Off',
177
+ unitChirpsMin: 'chirridos/min',
178
+ faqTitle: 'Preguntas Frecuentes',
179
+ bibliographyTitle: 'Referencias Científicas',
180
+ },
181
+ };
@@ -0,0 +1,181 @@
1
+ import type { WithContext, FAQPage, HowToThing, SoftwareApplication } from 'schema-dts';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+ import type { CricketThermometerUI } from '../ui';
4
+
5
+ const slug = 'thermometre-grillon';
6
+ const title = 'Thermomètre à Grillons – Loi de Dolbear';
7
+ const description =
8
+ 'Pas de thermomètre ? Écoutez les grillons. Calculez la température exacte en comptant les stridulations avec notre calculateur de la Loi de Dolbear.';
9
+
10
+ const faqData = [
11
+ {
12
+ question: 'Qu\'est-ce que la Loi de Dolbear ?',
13
+ answer:
14
+ 'Formulée en 1897 par Amos Dolbear, c\'est une observation scientifique qui a découvert une corrélation linéaire entre le rythme des stridulations d\'un grillon et la température ambiante de l\'air.',
15
+ },
16
+ {
17
+ question: 'Pourquoi les grillons strident-ils plus vite avec la chaleur ?',
18
+ answer:
19
+ 'Les grillons sont des animaux à sang froid (ectothermes). La vitesse de leurs processus métaboliques et de leurs contractions musculaires dépend de la température extérieure ; plus il fait chaud, plus ils ont d\'énergie pour émettre des sons rapidement.',
20
+ },
21
+ {
22
+ question: 'Cette mesure est-elle précise ?',
23
+ answer:
24
+ 'Elle est étonnamment précise pour des espèces comme le grillon des arbres enneigés (Oecanthus fultoni), avec une marge d\'erreur d\'environ 0,5°C si le comptage est correct. Cependant, des facteurs comme l\'humidité ou le vent peuvent altérer le résultat.',
25
+ },
26
+ {
27
+ question: 'Quel grillon dois-je utiliser pour le calcul ?',
28
+ answer:
29
+ 'La formule originale est basée sur le grillon des arbres enneigés. Pour le grillon des champs commun, la relation est similaire mais le rythme est généralement légèrement plus lent.',
30
+ },
31
+ ];
32
+
33
+ const howToData = [
34
+ {
35
+ name: 'Localiser un grillon solitaire',
36
+ text: 'Trouvez un endroit calme la nuit où vous pouvez entendre clairement la stridulation d\'un seul grillon pour ne pas confondre les rythmes.',
37
+ },
38
+ {
39
+ name: 'Compter les stridulations pendant 15 secondes',
40
+ text: 'Utilisez un chronomètre et comptez combien de stridulations l\'insecte émet en exactement 15 secondes.',
41
+ },
42
+ {
43
+ name: 'Entrer la valeur',
44
+ text: 'Appuyez sur le bouton TAP au rythme des stridulations pendant quelques secondes pour que la calculatrice calcule automatiquement les BPM.',
45
+ },
46
+ {
47
+ name: 'Vérifier la température',
48
+ text: 'Le système appliquera la formule T(°C) = 10 + (N - 40) / 7 pour vous donner une estimation de la chaleur ambiante en degrés Celsius.',
49
+ },
50
+ ];
51
+
52
+ const faqSchema: WithContext<FAQPage> = {
53
+ '@context': 'https://schema.org',
54
+ '@type': 'FAQPage',
55
+ mainEntity: faqData.map((item) => ({
56
+ '@type': 'Question',
57
+ name: item.question,
58
+ acceptedAnswer: { '@type': 'Answer', text: item.answer },
59
+ })),
60
+ };
61
+
62
+ const howToSchema: WithContext<HowToThing> = {
63
+ '@context': 'https://schema.org',
64
+ '@type': 'HowTo',
65
+ name: title,
66
+ description,
67
+ step: howToData.map((step, i) => ({
68
+ '@type': 'HowToStep',
69
+ position: i + 1,
70
+ name: step.name,
71
+ text: step.text,
72
+ })),
73
+ };
74
+
75
+ const appSchema: WithContext<SoftwareApplication> = {
76
+ '@context': 'https://schema.org',
77
+ '@type': 'SoftwareApplication',
78
+ name: title,
79
+ description,
80
+ applicationCategory: 'UtilityApplication',
81
+ operatingSystem: 'All',
82
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
83
+ inLanguage: 'fr',
84
+ };
85
+
86
+ export const content: ToolLocaleContent<CricketThermometerUI> = {
87
+ slug,
88
+ title,
89
+ description,
90
+ faqTitle: 'Questions Fréquentes',
91
+ faq: faqData,
92
+ bibliographyTitle: 'Références Scientifiques',
93
+ bibliography: [
94
+ {
95
+ name: 'The American Naturalist - The Cricket as a Thermometer',
96
+ url: 'https://www.jstor.org/stable/2453256',
97
+ },
98
+ {
99
+ name: 'Wikipedia - Dolbear\'s Law',
100
+ url: 'https://en.wikipedia.org/wiki/Dolbear%27s_law',
101
+ },
102
+ ],
103
+ howTo: howToData,
104
+ schemas: [faqSchema, howToSchema, appSchema],
105
+ seo: [
106
+ {
107
+ type: 'title',
108
+ text: 'Guide Complet : Comment Utiliser la Loi de Dolbear pour Calculer la Température',
109
+ level: 2,
110
+ },
111
+ {
112
+ type: 'paragraph',
113
+ html: 'Saviez-vous que vous pouvez connaître la température exacte rien qu\'en écoutant la nature ? En 1897, le physicien Amos Dolbear a découvert une relation mathématique précise entre le rythme des stridulations des grillons et la chaleur ambiante. Cet outil digitalise cette découverte pour transformer votre téléphone en thermomètre naturel.',
114
+ },
115
+ {
116
+ type: 'tip',
117
+ title: 'Pourquoi les grillons strident plus vite avec la chaleur ?',
118
+ html: '<p>Le "chant" du grillon, ou <strong>stridulation</strong>, est en réalité un appel nuptial. Les mâles frottent leurs ailes (pas leurs pattes) pour créer ce son. Ce qui est fascinant, c\'est qu\'étant des animaux à sang froid (ectothermes), la vitesse de ce frottement dépend directement de l\'énergie thermique de l\'air.</p>',
119
+ },
120
+ {
121
+ type: 'title',
122
+ text: 'La Science : Ectothermie et Métabolisme',
123
+ level: 3,
124
+ },
125
+ {
126
+ type: 'paragraph',
127
+ html: 'Contrairement aux mammifères, qui maintiennent une température corporelle constante, les insectes dépendent de la chaleur externe. Leurs réactions biochimiques suivent l\'<strong>Équation d\'Arrhenius</strong> : plus il fait chaud, plus la réaction est rapide.',
128
+ },
129
+ {
130
+ type: 'paragraph',
131
+ html: 'Cela signifie que pour que les muscles du grillon se contractent et frottent ses ailes, ils ont besoin de réactions enzymatiques. S\'il fait froid, ces réactions sont lentes et le chant est pausé. S\'il fait chaud, le métabolisme s\'accélère et le chant devient un trille frénétique.',
132
+ },
133
+ {
134
+ type: 'title',
135
+ text: 'La Formule de Dolbear',
136
+ level: 3,
137
+ },
138
+ {
139
+ type: 'paragraph',
140
+ html: 'Bien qu\'il existe des variantes pour différentes espèces, la formule la plus célèbre est celle du grillon des arbres enneigés (<em>Oecanthus fultoni</em>). Pour obtenir la température en degrés Celsius :',
141
+ },
142
+ {
143
+ type: 'code',
144
+ code: 'T(°C) = 10 + (N - 40) / 7\n\nOù N = nombre de stridulations par minute.',
145
+ ariaLabel: 'Formule de Dolbear pour calculer la température à partir des stridulations de grillon',
146
+ },
147
+ {
148
+ type: 'paragraph',
149
+ html: 'Notre outil fait cela automatiquement : il mesure le temps entre vos tapotements, calcule les stridulations par minute (BPM) et applique la formule instantanément.',
150
+ },
151
+ {
152
+ type: 'title',
153
+ text: 'Curiosités Fascinantes',
154
+ level: 3,
155
+ },
156
+ {
157
+ type: 'list',
158
+ items: [
159
+ '<strong>Thermomètres de l\'Amour :</strong> Certaines théories suggèrent que les femelles préfèrent les mâles qui chantent à la fréquence "correcte" pour la température actuelle, ce qui indique que le mâle est en bonne santé et a un métabolisme fort.',
160
+ '<strong>Limite du Froid :</strong> En dessous de 10°C (50°F), la plupart des grillons cessent de chanter car leur métabolisme est trop lent pour soutenir l\'effort musculaire.',
161
+ '<strong>Synchronisation :</strong> Par les nuits chaudes, des milliers de grillons peuvent synchroniser leurs stridulations, créant un impressionnant effet de "vague" sonore.',
162
+ ],
163
+ },
164
+ {
165
+ type: 'tip',
166
+ title: 'Note de Précision',
167
+ html: '<p>La précision dépend de l\'espèce de grillon. Cet outil est calibré pour le grillon des champs commun et le grillon des arbres. Des facteurs comme l\'humidité ou le vent peuvent modifier le résultat de ±0,5°C.</p>',
168
+ },
169
+ ],
170
+ ui: {
171
+ labelWaiting: 'En attente...',
172
+ labelTapping: 'Continuez à tapoter...',
173
+ tapInstruction: 'Chaque fois que vous entendez une stridulation',
174
+ btnReset: 'Réinitialiser',
175
+ btnSoundOn: 'Son : On',
176
+ btnSoundOff: 'Son : Off',
177
+ unitChirpsMin: 'strid./min',
178
+ faqTitle: 'Questions Fréquentes',
179
+ bibliographyTitle: 'Références Scientifiques',
180
+ },
181
+ };
@@ -0,0 +1,34 @@
1
+ import type { NatureToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import CricketThermometerComponent from './component.astro';
3
+ import CricketThermometerSEO from './seo.astro';
4
+ import CricketThermometerBibliography from './bibliography.astro';
5
+
6
+ import type { CricketThermometerUI } from './ui';
7
+
8
+ export type CricketThermometerLocaleContent = ToolLocaleContent<CricketThermometerUI>;
9
+
10
+ import { content as es } from './i18n/es';
11
+ import { content as en } from './i18n/en';
12
+ import { content as fr } from './i18n/fr';
13
+
14
+ export const cricketThermometer: NatureToolEntry<CricketThermometerUI> = {
15
+ id: 'cricket-thermometer',
16
+ icons: {
17
+ bg: 'mdi:thermometer',
18
+ fg: 'mdi:grass',
19
+ },
20
+ i18n: {
21
+ es: async () => es,
22
+ en: async () => en,
23
+ fr: async () => fr,
24
+ },
25
+ };
26
+
27
+ export { CricketThermometerComponent, CricketThermometerSEO, CricketThermometerBibliography };
28
+
29
+ export const CRICKET_THERMOMETER_TOOL: ToolDefinition = {
30
+ entry: cricketThermometer,
31
+ Component: CricketThermometerComponent,
32
+ SEOComponent: CricketThermometerSEO,
33
+ BibliographyComponent: CricketThermometerBibliography,
34
+ };
@@ -0,0 +1,6 @@
1
+ export function calculateTemperature(chirpsPerMinute: number): number {
2
+ return 10 + (chirpsPerMinute - 40) / 7;
3
+ }
4
+
5
+ export const MIN_TEMP_DISPLAY = 0;
6
+ export const MAX_TEMP_DISPLAY = 45;
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { cricketThermometer } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'es' } = Astro.props;
11
+ const content = await cricketThermometer.i18n[locale]?.();
12
+ if (!content) return null;
13
+ ---
14
+
15
+ <SEORenderer content={{ locale: locale as string, sections: content.seo }} />
@@ -0,0 +1,11 @@
1
+ export interface CricketThermometerUI extends Record<string, string> {
2
+ labelWaiting: string;
3
+ labelTapping: string;
4
+ tapInstruction: string;
5
+ btnReset: string;
6
+ btnSoundOn: string;
7
+ btnSoundOff: string;
8
+ unitChirpsMin: string;
9
+ faqTitle: string;
10
+ bibliographyTitle: string;
11
+ }
@@ -0,0 +1,9 @@
1
+ ---
2
+ import { Bibliography as SharedBibliography } from '@jjlmoya/utils-shared';
3
+ import { digitalCarbon } from './index';
4
+
5
+ const { locale = 'es' } = Astro.props;
6
+ const content = await digitalCarbon.i18n[locale as keyof typeof digitalCarbon.i18n]?.();
7
+ ---
8
+
9
+ {content && <SharedBibliography links={content.bibliography} />}