Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
3628 lines (3485 loc) · 152 KB
/
Copy pathapp.js
File metadata and controls
3628 lines (3485 loc) · 152 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
const translations = {
de: {
install: "Installieren",
installDialogTitle: "App installieren",
installDialogClose: "Verstanden",
installFirefoxHint: "Firefox bietet je nach Version und Betriebssystem keinen automatischen Installationsknopf. Öffne das Firefox-Menü und suche nach „Als App installieren“ oder „Zu Startbildschirm hinzufügen“. Fehlt die Option, kann diese Firefox-Version PWA-Installationen nicht anbieten.",
installOtherHint: "Öffne das Browser-Menü und suche nach „Zum Startbildschirm hinzufügen“, „App installieren“ oder „Seite hinzufügen“. Die genaue Bezeichnung hängt von Browser und Gerät ab.",
names: "Namen",
hardnessTab: "Mohs-Härte",
propertiesTab: "Eigenschaften",
startTab: "Start",
quizTab: "Quiz",
primaryNavigation: "Hauptnavigation",
quickControls: "Schnelleinstellungen",
openNavigation: "Menü öffnen",
closeNavigation: "Menü schließen",
retryOfflineImages: "Offline-Bilder laden",
soundEnabled: "Töne bei Antworten, Menüs und Rundenenden",
pageTitle: "Finde deinen nächsten Fund.",
pageDescription: "Wähle dein Lernziel und starte eine Runde in deinem Tempo.",
modeTitle: "Übungsart",
homeSpecimenLabel: "Dein nächster Fund",
gemstoneCarousel: "Edelsteinbilder",
carouselSlideLabel: "Bild {current} von {total}: {name}",
learningPathToday: "Dein Lernpfad heute",
learningPathSteps: "Üben · festigen · wiedererkennen",
settingsTitle: "Einstellungen",
photoPackTitle: "Zusatzbilder für Edelsteine",
photoPackDescription: "Lade weitere Aufnahmen einmalig herunter. Danach sind sie auch offline verfügbar.",
downloadPhotoPack: "Zusatzbilder laden",
photoPackDownloading: "Zusatzbilder werden geladen …",
photoPackChecking: "Offline-Zusatzbilder werden geprüft …",
photoPackReady: "{count} Zusatzbilder sind offline verfügbar.",
photoPackPartial: "{cached} von {total} Zusatzbildern gespeichert. Fehlende Bilder kannst du erneut laden.",
photoPackNone: "Für dieses Bildpaket sind keine zusätzlichen Aufnahmen verfügbar.",
photoPackError: "Das Bildpaket konnte nicht gespeichert werden. Prüfe deine Verbindung und versuche es erneut.",
photoPackDownloaded: "Zusatzbilder geladen",
usePhotoVariety: "Zusatzbilder beim Üben verwenden",
photoPackProgress: "{cached} von {total} Zusatzbildern gespeichert",
photoPackProgressLabel: "Zusatzbilder: {cached} von {total} gespeichert",
photoPackCheckingProgress: "{completed} von {total} Zusatzbildern geprüft",
streak: "Tage in Folge",
due: "zur Wiederholung",
reviewDue: "Fällige Steine wiederholen: {count}",
specimen: "Stein",
colorReading: "Farbprobe",
difficult: "Schwieriger Stein",
type: "Eintippen",
typeDescription: "Antworte selbst – ohne vorgegebene Auswahl.",
flashcard: "Karteikarte",
flashcardDescription: "Rufe die Antwort aus dem Gedächtnis ab, decke sie auf und bewerte dich.",
flashcardRevealPrompt: "Karte antippen, um den Namen aufzudecken",
flashcardAnswerSide: "Name des Edelsteins",
choice: "Auswahl",
choiceDescription: "Wähle die passende Antwort aus mehreren Möglichkeiten.",
matching: "Zuordnen",
matchingDescription: "Ordne Steine den passenden Namen, Bildern oder Angaben zu.",
review: "Wiederholen",
reviewDescription: "Wiederholung: zuerst fällige Lernkarten; ohne Fälligkeit wird ein Stein aus deinem Lernpfad gewählt.",
timed: "60-Sekunden-Quiz",
timedDescription: "Erkenne in 60 Sekunden so viele Steine wie möglich. Häufige Handelsware erscheint öfter; seltene Steine bleiben im Pool. Die Verfügbarkeitsstufen sind redaktionelle Einschätzungen, keine Marktstatistik.",
timedStatusLabel: "Zeitquiz-Status",
timedTimer: "Zeit {time}",
timedScore: "Punkte {score}",
timedTier: "Verfügbarkeit: {tier}",
learningAreaPickerLabel: "Lernbereich auswählen: {area}",
tierCommon: "häufig",
tierOccasional: "gelegentlich",
tierRare: "selten",
timedResult: "{score} Punkte · {answered} Antworten",
quizAnswerLabel: "Die Antwort ist:",
quizNotQuite: "Nicht ganz.",
timedReviewTitle: "Deine Antworten",
timedReviewCorrect: "Richtig",
timedReviewIncorrect: "Falsch",
timedReviewUnanswered: "Nicht beantwortet",
timedReviewAttempt: "Deine Antwort: {answer}",
timedReviewImageAlt: "Bild von {name}",
timedReviewBlankAnswer: "leere Eingabe",
homeImageLoading: "Steinbild wird geladen …",
loadingImageProgress: "Steinbild wird geladen",
loadingDataProgress: "Steinsammlung wird geladen",
loadingSensitivityProgress: "Werkstatttabelle wird geladen",
loadingWorkshopProgress: "PDF-Werkstatttabelle wird geladen",
offlineProgress: "Offline-Bilder werden gespeichert",
updateProgress: "App-Aktualisierung wird geladen",
updateProgressCount: "{completed} von {total} Aktualisierungsschritten abgeschlossen",
importProgress: "Sicherung wird geladen",
homeImageUnavailable: "Steinbild gerade nicht verfügbar.",
next: "Nächster Stein",
continueQuestion: "Weiter",
source: "Quelle ansehen",
progressTitle: "Stein um Stein",
progressEmpty: "Dein Fortschritt bleibt auf diesem Gerät gespeichert.",
progressDone: "Heute bearbeitet",
difficultList: "Noch üben",
collectionTitle: "Steinbibliothek",
searchLabel: "Steine durchsuchen",
searchPlaceholder: "Name, Farbe oder Fundort suchen",
attribution: "Edelstein-Steckbriefe und Bilder:",
offlineNote: "Lernfortschritt wird nur auf diesem Gerät gespeichert.",
questionName: "Welcher Stein ist das?",
questionHardness: "Wie hart ist dieser Stein nach Mohs?",
questionProperty: "Welche Angabe trifft auf {property} zu?",
answerLabel: "Deine Antwort",
answerPlaceholder: "Antwort eintippen …",
check: "Prüfen",
reveal: "Antwort aufdecken",
knewIt: "Wusste ich",
practiceAgain: "Noch üben",
correct: "Richtig — gut erkannt.",
incorrect: "Knapp – betrachte den Stein nochmal genauer. Die Antwort ist:",
selectPair: "Wähle erst links, dann die passende Angabe rechts.",
wrongPair: "Das passt noch nicht. Versuch es erneut.",
matched: "Zuordnung stimmt.",
allMatched: "Alle Zuordnungen stimmen. Stark kombiniert!",
continue: "Weiterlernen",
roundReady: "Neue Runde",
roundTitle: "Dein Lernziel",
roundDescription: "Was möchtest du heute lernen?",
goalScopeLabel: "Welche Steine?",
goalGroupLabel: "Steingruppe",
scopeStarter: "20 Basissteine",
scopeFavorites: "Meine Favoriten",
scopeFamily: "Eine Steingruppe",
scopeAll: "Alle Steine",
goalSummary: "{count} Steine verfügbar · bis zu 10 pro Runde",
goalNoFavorites: "Markiere zuerst Favoriten in der Steinbibliothek.",
goalEmptyGroup: "Für diese Steingruppe sind keine passenden Aufgaben verfügbar.",
startRound: "Runde starten",
roundComplete: "Runde beendet",
backToGoal: "Zurück zum Lernziel",
leaveRound: "Runde verlassen",
roundResult: "{correct} von {total} richtig",
roundResultDetail: "Modus: {mode}",
noQuestions: "Für diese Eigenschaft liegen in der Quelle noch keine Angaben vor.",
missingSource: "Keine Angabe in der Quelle",
unavailableFormation: "Die Enzyklopädie nennt keine geologische Entstehung für diesen Eintrag.",
noDue: "Nichts ist gerade fällig. Wir wiederholen einen Stein aus deinem Lernpfad.",
noDifficult: "Noch keine schwierigen Steine markiert.",
offlineChecking: "Offline-Daten werden geprüft …",
offlineReady: "Offline-Bibliothek bereit",
offlinePartial: "Offline-Bibliothek unvollständig: {count} Bilder fehlen",
offlineMissing: "Offline-Bibliothek noch nicht vollständig",
offlineRetry: "Tippen zum erneuten Laden der Bilder",
offlineError: "Offline-Speicherung nicht verfügbar",
offlineProgressCount: "{completed} von {total} Offline-Bildern verarbeitet",
onlineOnly: "Online verfügbar",
online: "Online",
offline: "Offline",
loading: "Steine werden geladen …",
loadError: "Die lokale Steinsammlung konnte nicht geladen werden. Lade die Seite neu, sobald eine Verbindung besteht.",
storageError: "Der Browser kann Lernfortschritte nicht speichern.",
savedLocal: "Fortschritt lokal gespeichert",
noSearchResults: "Keine passenden Steine gefunden.",
searchResults: "{shown} von {total} Steinen",
myCollection: "Meine Sammlung",
collectionSummary: "{owned} sicher gelernte Steine · {seals} erhaltene Auszeichnungen",
rankNames: "Rohling|Geschliffen|Poliert|Juwel|Meisterstein",
ownedCount: "{count} sicher gelernte Steine",
rankMeter: "Sicher gelernte Steine bis zum nächsten Rang",
rankLadderLabel: "Alle Rangstufen",
rankCurrent: "Aktuell",
rankReached: "Erreicht",
rankLocked: "Gesperrt",
rankBeginning: "Start",
rankUnlockAtOne: "Ab 1 Stein",
rankUnlockAt: "Ab {count} Steinen",
dailyExpedition: "Tagesziel",
dailyExpeditionTask: "Erkenne 10 Steine richtig",
dailyExpeditionProgress: "{done}/10",
dailyExpeditionComplete: "Tagesziel geschafft · {done}/10",
streakPreserved: "Deine Fundserie ist für heute bewahrt.",
weeklyExpedition: "Wochenziel",
weeklyExpeditionTask: "Meistere 10 neue Steine",
weeklyExpeditionProgress: "{done}/10 sichere Fundstücke · Auszeichnung „Sammler“ bei Ziel",
sealsTitle: "Auszeichnungen",
sealFirst: "Erster Fund",
sealStreak: "Fleißiger Sammler",
sealTwenty: "Hüter der 20",
sealGroups: "Gruppen-Meister",
sealFavorites: "Favoriten-Kenner",
sealPerfect: "Lupenrein",
sealCollector: "Sammler",
sealLocked: "Noch nicht erhalten",
inCollection: "Im Besitz",
favorite: "Favorit",
dailyStreak: "Fundserie",
streakDay: "Tag {count}",
preserveStreak: "Fundserie bewahren",
newRank: "Ein neuer Rang: {rank}!",
roundLoot: "Neue Steine: {newStones} · Fundserie Tag {streak}",
newSeals: "Neue Auszeichnungen: {seals}",
noNewSeals: "Noch keine neue Auszeichnung",
sensitivityTitle: "Werkstatt-Empfindlichkeit",
sensitivityNavShort: "Werkstatt",
sensitivityQuarterLabel: "{filled} von 4 Abschnitten in der Vorlage dunkel gefüllt",
sensitivityStone: "Stein",
sensitivityPage: "Seiten",
sensitivitySearchPlaceholder: "Stein oder Seitenangabe suchen",
sensitivityAcid: "Säure",
sensitivityLye: "Lauge",
sensitivityHeat: "Hitze",
sensitivityUltrasound: "Ultraschall",
sensitivityImpact: "Druck/Schlag",
sensitivityReview: "Bitte prüfen",
sensitivityEmpty: "Keine passenden Tabellenzeilen gefunden.",
sensitivityLoadError: "Die Empfindlichkeitstabelle konnte nicht geladen werden. Lade die Seite neu, sobald eine Verbindung besteht.",
sensitivityResults: "{shown} von {total} Einträgen",
workshopTableTitle: "Weitere Empfindlichkeitstabelle",
workshopPdfSearch: "Eintrag oder Feldinhalt suchen",
workshopPdfLoadError: "Die PDF-Tabelle konnte nicht geladen werden. Lade die Seite neu, sobald eine Verbindung besteht.",
workshopPdfEmpty: "Keine passenden PDF-Einträge gefunden.",
sensitivityCleavage: "Spaltbarkeit / Elastizität",
sensitivityColorChange: "Farbänderung",
sensitivityAcids: "Säuren",
sensitivityCementSolvents: "Kittlösemittel",
dataTools: "Einstellungen & Datensicherung",
showCollectionProgress: "Sammler-Fortschritt anzeigen",
exportData: "Daten sichern",
restoreData: "Sicherung wiederherstellen",
resetData: "App-Daten zurücksetzen",
checkUpdates: "Auf Aktualisierungen prüfen",
checkingUpdates: "Suche nach Aktualisierungen …",
updateFound: "Ein Update wurde gefunden und wird geladen.",
updateReady: "Aktualisierung bereit. Lade die App neu.",
currentVersion: "Du verwendest die aktuelle Version.",
updateError: "Aktualisierung fehlgeschlagen. Prüfe deine Internetverbindung und versuche es erneut.",
reloadApp: "App neu laden",
reloadAppShort: "Neu laden",
updateShort: "Update",
versionLabel: "Version {version}",
appVersion: "App-Version",
resetConfirm: "Alle Lernstände und Einstellungen auf diesem Gerät zurücksetzen? Exportiere vorher eine Sicherung, wenn du sie behalten möchtest.",
resetDone: "Die App-Daten wurden zurückgesetzt.",
exportDone: "Sicherung wurde heruntergeladen.",
importDone: "Sicherung wurde wiederhergestellt.",
importError: "Sicherung konnte nicht gelesen werden. Deine vorhandenen Daten sind unverändert.",
noOwnedStones: "Deine sicher gelernten Steine erscheinen hier.",
moreDetails: "Sammlung & mehr",
crystalDiagram: "Kristallform aus dem Quellen-Steckbrief",
crystalImageAlt: "Kristallform von {stone} ({system})",
crystalExample: "Beispielstein: {stone}",
crystalImageSource: "Bildquelle: {stone}",
noCrystalLattice: "kein Kristallgitter",
propertyName: "Name",
propertyHardness: "Mohs-Härte",
propertyFormula: "Chemische Formel",
propertyColor: "Farbe",
propertyOtherColors: "Weitere Farben",
propertyStreak: "Strichfarbe",
propertyLuster: "Glanz",
propertyCleavage: "Spaltbarkeit",
propertyDensity: "Dichte",
propertyFracture: "Bruch",
propertyTransparency: "Transparenz",
propertyRefraction: "Lichtbrechung",
propertyCrystalSystem: "Kristallsystem",
propertyLocations: "Fundorte",
propertyFormation: "Geologische Entstehung",
incompleteHardness: "Die Quelle nennt 0.0 als Obergrenze; angezeigt wird nur der angegebene Wert.",
answerFor: "Antwort für {name}",
displayPair: "Bild",
comparePair: "Angabe",
streakLabel: "Serie",
noSourceData: "Keine Übungsdaten für diesen Bereich.",
difficultMarked: "Als schwierig markiert.",
difficultUnmarked: "Markierung entfernt.",
ariaLearningAreas: "Lernbereiche",
ariaPracticeModes: "Übungsart",
ariaDailyProgress: "Lernfortschritt heute",
gemAlt: "Edelstein",
otherLanguage: "Name in der anderen Sprache",
metaDescription: "Lerne Edelstein-Namen und ihre Eigenschaften mit Lernstein — zweisprachig, kostenlos und offline.",
knownColors: "Bekannte Farben",
matchingImage: "Name + Bild",
matchingLanguage: "Deutsch + Englisch",
propertyFracture: "Bruch",
propertyOtherColors: "Weitere Farben",
},
en: {
install: "Install",
installDialogTitle: "Install app",
installDialogClose: "Got it",
installFirefoxHint: "Firefox does not offer an automatic install button on every version and operating system. Open the Firefox menu and look for “Install” or “Add to home screen.” If the option is missing, this Firefox version cannot install PWAs.",
installOtherHint: "Open the browser menu and look for “Add to home screen,” “Install app,” or “Add page.” The exact label depends on your browser and device.",
names: "Names",
hardnessTab: "Mohs hardness",
propertiesTab: "Properties",
startTab: "Start",
quizTab: "Quiz",
primaryNavigation: "Main navigation",
quickControls: "Quick controls",
openNavigation: "Open menu",
closeNavigation: "Close menu",
retryOfflineImages: "Load offline images",
soundEnabled: "Sounds for answers, menus, and round endings",
pageTitle: "Find your next discovery.",
pageDescription: "Choose your learning goal and start a round at your own pace.",
modeTitle: "Practice format",
homeSpecimenLabel: "Your next discovery",
gemstoneCarousel: "Gemstone photos",
carouselSlideLabel: "Photo {current} of {total}: {name}",
learningPathToday: "Your learning path today",
learningPathSteps: "Practice · strengthen · recognize",
settingsTitle: "Settings",
photoPackTitle: "Additional gemstone photos",
photoPackDescription: "Download extra photographs once. They will then be available offline.",
downloadPhotoPack: "Download extra photos",
photoPackDownloading: "Downloading extra photos …",
photoPackChecking: "Checking offline extra photos …",
photoPackReady: "{count} extra photos are available offline.",
photoPackPartial: "{cached} of {total} extra photos saved. You can retry missing photos.",
photoPackNone: "No additional photographs are available in this pack.",
photoPackError: "The photo pack could not be saved. Check your connection and try again.",
photoPackDownloaded: "Extra photos downloaded",
usePhotoVariety: "Use extra photos while practicing",
photoPackProgress: "{cached} of {total} extra photos saved",
photoPackProgressLabel: "Extra photos: {cached} of {total} saved",
photoPackCheckingProgress: "{completed} of {total} extra photos checked",
streak: "day streak",
due: "ready to review",
reviewDue: "Review {count} due stones",
specimen: "Stone",
colorReading: "Color sample",
difficult: "Difficult stone",
type: "Type answer",
typeDescription: "Recall the answer yourself without multiple-choice prompts.",
flashcard: "Flashcard",
flashcardDescription: "Recall the answer, reveal it, then rate how well you knew it.",
flashcardRevealPrompt: "Activate the card to reveal its name",
flashcardAnswerSide: "Gemstone name",
choice: "Choose",
choiceDescription: "Choose the best answer from several options.",
matching: "Match",
matchingDescription: "Match stones with their names, pictures, or properties.",
review: "Review",
reviewDescription: "Review: practice due items first; if nothing is due, choose a stone from your learning path.",
timed: "60-second quiz",
timedDescription: "Recognize as many stones as you can in 60 seconds. Commonly traded stones appear more often; rare stones remain in the pool. Availability tiers are editorial estimates, not market statistics.",
timedStatusLabel: "Timed quiz status",
timedTimer: "Time {time}",
timedScore: "Points {score}",
timedTier: "Availability: {tier}",
learningAreaPickerLabel: "Choose learning area: {area}",
tierCommon: "common",
tierOccasional: "occasional",
tierRare: "rare",
timedResult: "{score} points · {answered} answers",
quizAnswerLabel: "The answer is:",
quizNotQuite: "Not quite.",
timedReviewTitle: "Your answers",
timedReviewCorrect: "Correct",
timedReviewIncorrect: "Incorrect",
timedReviewUnanswered: "Not answered",
timedReviewAttempt: "Your answer: {answer}",
timedReviewImageAlt: "Image of {name}",
timedReviewBlankAnswer: "blank entry",
homeImageLoading: "Loading the stone image …",
loadingImageProgress: "Loading gemstone image",
loadingDataProgress: "Loading gemstone collection",
loadingSensitivityProgress: "Loading workshop table",
loadingWorkshopProgress: "Loading PDF workshop table",
offlineProgress: "Saving offline images",
updateProgress: "Loading app update",
updateProgressCount: "{completed} of {total} update steps complete",
importProgress: "Loading backup",
homeImageUnavailable: "The stone image is unavailable right now.",
next: "Next stone",
continueQuestion: "Continue",
source: "View source",
progressTitle: "Stone by stone",
progressEmpty: "Your progress stays on this device.",
progressDone: "Practiced today",
difficultList: "Practice again",
collectionTitle: "Stone library",
searchLabel: "Search gemstones",
searchPlaceholder: "Search name, color, or location",
attribution: "Gemstone profiles and images:",
offlineNote: "Learning progress is stored only on this device.",
questionName: "Which stone is this?",
questionHardness: "How hard is this stone on the Mohs scale?",
questionProperty: "What is the {property}?",
answerLabel: "Your answer",
answerPlaceholder: "Type your answer …",
check: "Check",
reveal: "Reveal answer",
knewIt: "I knew it",
practiceAgain: "Practice again",
correct: "Correct — well recognized.",
incorrect: "Close — take another look at the stone. The answer is:",
selectPair: "Choose on the left, then match it on the right.",
wrongPair: "That is not a match yet. Try again.",
matched: "Match found.",
allMatched: "All pairs matched. Nicely done!",
continue: "Keep learning",
roundReady: "New round",
roundTitle: "Your learning goal",
roundDescription: "What would you like to learn today?",
goalScopeLabel: "Which stones?",
goalGroupLabel: "Stone group",
scopeStarter: "20 foundation stones",
scopeFavorites: "My favorites",
scopeFamily: "One stone group",
scopeAll: "All stones",
goalSummary: "{count} stones available · up to 10 per round",
goalNoFavorites: "Mark some favorites in the Stone library first.",
goalEmptyGroup: "There are no matching questions in this stone group.",
startRound: "Start round",
roundComplete: "Round complete",
backToGoal: "Back to your goal",
leaveRound: "Leave round",
roundResult: "{correct} of {total} correct",
roundResultDetail: "Mode: {mode}",
noQuestions: "The source has no facts for this property yet.",
missingSource: "Not specified in the source",
unavailableFormation: "The encyclopedia does not specify a geological formation for this entry.",
noDue: "Nothing is due right now. Here is a stone from your learning path.",
noDifficult: "No difficult stones marked yet.",
offlineChecking: "Checking offline library …",
offlineReady: "Offline library ready",
offlinePartial: "Offline library incomplete: {count} images missing",
offlineMissing: "Offline library is incomplete",
offlineRetry: "Tap to retry downloading images",
offlineError: "Offline storage is unavailable",
offlineProgressCount: "{completed} of {total} offline images processed",
onlineOnly: "Available online",
online: "Online",
offline: "Offline",
loading: "Loading gemstones …",
loadError: "The local gemstone collection could not be loaded. Reload when a connection is available.",
storageError: "This browser cannot save learning progress.",
savedLocal: "Progress saved locally",
noSearchResults: "No matching gemstones found.",
searchResults: "{shown} of {total} stones",
myCollection: "My collection",
collectionSummary: "{owned} confidently learned stones · {seals} earned awards",
rankNames: "Rough|Cut|Polished|Jewel|Master gem",
ownedCount: "{count} confidently learned stones",
rankMeter: "Confidently learned stones until the next rank",
rankLadderLabel: "All rank levels",
rankCurrent: "Current",
rankReached: "Reached",
rankLocked: "Locked",
rankBeginning: "Start",
rankUnlockAtOne: "From 1 stone",
rankUnlockAt: "From {count} stones",
dailyExpedition: "Today's goal",
dailyExpeditionTask: "Recognize 10 stones correctly",
dailyExpeditionProgress: "{done}/10",
dailyExpeditionComplete: "Today's goal complete · {done}/10",
streakPreserved: "Your find series is preserved for today.",
weeklyExpedition: "Weekly goal",
weeklyExpeditionTask: "Master 10 new stones",
weeklyExpeditionProgress: "{done}/10 confidently learned · “Collector” award at goal",
sealsTitle: "Awards",
sealFirst: "First find",
sealStreak: "Diligent collector",
sealTwenty: "Keeper of 20",
sealGroups: "Group master",
sealFavorites: "Favorite expert",
sealPerfect: "Flawless lens",
sealCollector: "Collector",
sealLocked: "Not earned yet",
inCollection: "Collected",
favorite: "Favorite",
dailyStreak: "Find series",
streakDay: "Day {count}",
preserveStreak: "Preserve find series",
newRank: "A new rank: {rank}!",
roundLoot: "New stones: {newStones} · Day {streak} find series",
newSeals: "New awards: {seals}",
noNewSeals: "No new award this time",
sensitivityTitle: "Workshop sensitivity",
sensitivityNavShort: "Workshop",
sensitivityQuarterLabel: "{filled} of 4 segments filled dark in the source",
sensitivityStone: "Stone",
sensitivityPage: "Pages",
sensitivitySearchPlaceholder: "Search stone or page",
sensitivityAcid: "Acid",
sensitivityLye: "Lye",
sensitivityHeat: "Heat",
sensitivityUltrasound: "Ultrasound",
sensitivityImpact: "Pressure/impact",
sensitivityReview: "Please review",
sensitivityEmpty: "No matching table rows found.",
sensitivityLoadError: "The sensitivity table could not be loaded. Reload the page when a connection is available.",
sensitivityResults: "{shown} of {total} entries",
workshopTableTitle: "Additional sensitivity table",
workshopPdfSearch: "Search entries or cell text",
workshopPdfLoadError: "The PDF table could not be loaded. Reload the page when a connection is available.",
workshopPdfEmpty: "No matching PDF entries found.",
sensitivityCleavage: "Cleavage / elasticity",
sensitivityColorChange: "Color change",
sensitivityAcids: "Acids",
sensitivityCementSolvents: "Cement solvents",
dataTools: "Settings & data backup",
showCollectionProgress: "Show collector progress",
exportData: "Back up data",
restoreData: "Restore backup",
resetData: "Reset app data",
checkUpdates: "Check for updates",
checkingUpdates: "Checking for updates …",
updateFound: "An update was found and is loading.",
updateReady: "Update ready. Reload the app.",
currentVersion: "You’re using the latest version.",
updateError: "Update check failed. Check your internet connection and try again.",
reloadApp: "Reload app",
reloadAppShort: "Reload",
updateShort: "Update",
versionLabel: "Version {version}",
appVersion: "App version",
resetConfirm: "Reset all learning progress and settings on this device? Export a backup first if you want to keep them.",
resetDone: "App data has been reset.",
exportDone: "Backup downloaded.",
importDone: "Backup restored.",
importError: "Could not read the backup. Your existing data is unchanged.",
noOwnedStones: "Stones you have confidently learned will appear here.",
moreDetails: "Collection & more",
crystalDiagram: "Crystal form from the source profile",
crystalImageAlt: "Crystal form of {stone} ({system})",
crystalExample: "Example stone: {stone}",
crystalImageSource: "Image source: {stone}",
noCrystalLattice: "no crystal lattice",
propertyName: "Name",
propertyHardness: "Mohs hardness",
propertyFormula: "Chemical formula",
propertyColor: "Color",
propertyOtherColors: "Other colors",
propertyStreak: "Streak",
propertyLuster: "Luster",
propertyCleavage: "Cleavage",
propertyDensity: "Density",
propertyFracture: "Fracture",
propertyTransparency: "Transparency",
propertyRefraction: "Refractive index",
propertyCrystalSystem: "Crystal system",
propertyLocations: "Locations",
propertyFormation: "Geological formation",
incompleteHardness: "The source lists 0.0 as the upper bound; only the available value is shown.",
answerFor: "Answer for {name}",
displayPair: "Image",
comparePair: "Fact",
streakLabel: "Streak",
noSourceData: "No practice facts are available in this area.",
difficultMarked: "Marked as difficult.",
difficultUnmarked: "Mark removed.",
ariaLearningAreas: "Learning areas",
ariaPracticeModes: "Practice mode",
ariaDailyProgress: "Learning progress today",
gemAlt: "Gemstone",
otherLanguage: "Name in the other language",
metaDescription: "Learn gemstone names and properties with Lernstein — bilingual and offline.",
knownColors: "Known colors",
matchingImage: "Name + image",
matchingLanguage: "German + English",
},
};
const propertyOptions = [
["chemical_formula", "propertyFormula"],
["color", "propertyColor"],
["other_colors", "propertyOtherColors"],
["streak", "propertyStreak"],
["luster", "propertyLuster"],
["cleavage", "propertyCleavage"],
["density", "propertyDensity"],
["fracture", "propertyFracture"],
["transparency", "propertyTransparency"],
["refractive_index", "propertyRefraction"],
["crystal_system", "propertyCrystalSystem"],
["locations", "propertyLocations"],
["formation", "propertyFormation"],
];
const learningOptions = [
["names", "names"],
["hardness", "propertyHardness"],
...propertyOptions,
];
const FOUNDATION_STONE_IDS = [
"gem-006", "gem-007", "gem-012", "gem-016", "gem-070", "gem-077", "gem-085",
"gem-095", "gem-102", "gem-133", "gem-142", "gem-154", "gem-171", "gem-174",
"gem-183", "gem-211", "gem-213", "gem-254", "gem-255", "gem-280",
];
const RANK_THRESHOLDS = [0, 1, 10, 40, 100];
const CRYSTAL_SYSTEM_IMAGES = {
cubic: { src: "./assets/crystal-systems/garnet.gif", stoneId: "gem-012" },
tetragonal: { src: "./assets/crystal-systems/anatase.gif", stoneId: "gem-019" },
orthorhombic: { src: "./assets/crystal-systems/adamite.gif", stoneId: "gem-002" },
hexagonal: { src: "./assets/crystal-systems/afghanite.gif", stoneId: "gem-005" },
trigonal: { src: "./assets/crystal-systems/quartz-prismatic.gif", stoneId: "gem-016" },
monoclinic: { src: "./assets/crystal-systems/actinolite.gif", stoneId: "gem-001" },
triclinic: { src: "./assets/crystal-systems/aenigmatite.gif", stoneId: "gem-004" },
};
const SEALS = [
["first", "sealFirst"],
["streak", "sealStreak"],
["twenty", "sealTwenty"],
["groups", "sealGroups"],
["favorites", "sealFavorites"],
["perfect", "sealPerfect"],
["collector", "sealCollector"],
];
const colorNames = {
de: {
weiß: "#f7f5eb", weiss: "#f7f5eb", farblos: "#d8e5e2", blau: "#5288c4", braun: "#80604a",
grau: "#8c9997", gelb: "#e5bd45", schwarz: "#293436", orange: "#dc8040", rosa: "#d98ca4",
rot: "#c45758", grün: "#4b946d", violett: "#8064a9", pink: "#d883aa",
},
en: {
white: "#f7f5eb", colourless: "#d8e5e2", colorless: "#d8e5e2", blue: "#5288c4", brown: "#80604a",
grey: "#8c9997", gray: "#8c9997", yellow: "#e5bd45", black: "#293436", orange: "#dc8040",
pink: "#d98ca4", red: "#c45758", green: "#4b946d", violet: "#8064a9", purple: "#8064a9",
},
};
const STORAGE_KEY = "lernstein-state-v1";
const StateStore = window.LernsteinState;
const translationsFor = (key) => translations[state.language][key] || key;
const ui = {
topbar: document.querySelector(".topbar"),
topbarMenuButton: document.querySelector("#topbar-menu-button"),
topbarMenuPanel: document.querySelector("#topbar-menu-panel"),
topbarNav: document.querySelector("#topbar-nav"),
topbarPanels: [...document.querySelectorAll(".topbar-panel")],
offlineButton: document.querySelector("#offline-status"),
offlineLabel: document.querySelector("#offline-label"),
offlinePanelCopy: document.querySelector("#offline-panel-copy"),
offlineRetryButton: document.querySelector("#offline-retry-button"),
updateControl: document.querySelector(".update-control"),
updatePanelTrigger: document.querySelector("#update-panel-trigger"),
installControl: document.querySelector("#install-control"),
installPanelTrigger: document.querySelector("#install-panel-trigger"),
installButton: document.querySelector("#install-button"),
installDialog: document.querySelector("#install-dialog"),
installDialogCopy: document.querySelector("#install-dialog-copy"),
installDialogClose: document.querySelector("#install-dialog-close"),
languageButton: document.querySelector("#language-button"),
themeButton: document.querySelector("#theme-button"),
learningTabsShell: document.querySelector(".learning-tabs-shell"),
learningAreaSelector: document.querySelector("#learning-area-selector"),
learningAreaSummary: document.querySelector("#learning-area-summary"),
learningAreaSummaryIcon: document.querySelector("#learning-area-summary-icon"),
learningAreaSummaryLabel: document.querySelector("#learning-area-summary-label"),
learningTabs: document.querySelector("#learning-tabs"),
tabs: [],
pageTitle: document.querySelector("#page-title"),
pageDescription: document.querySelector("#page-description"),
streak: document.querySelector("#streak-value"),
due: document.querySelector("#due-value"),
reviewStartButton: document.querySelector("#review-start-button"),
index: document.querySelector("#specimen-index"),
figure: document.querySelector("#specimen-figure"),
specimenName: document.querySelector("#specimen-name"),
specimenFamily: document.querySelector("#specimen-family"),
colorReading: document.querySelector(".color-reading"),
graphicLabel: document.querySelector("#graphic-label"),
colorSwatches: document.querySelector("#color-swatches"),
propertyScale: document.querySelector("#property-scale"),
colorText: document.querySelector("#color-reading-text"),
sourceNote: document.querySelector("#source-note"),
crystalSystemVisual: document.querySelector("#crystal-system-visual"),
homeConfig: document.querySelector("#home-config"),
homeDailyBrief: document.querySelector(".home-daily-brief"),
homeDailyCopy: document.querySelector("#home-daily-copy"),
homeDailyFill: document.querySelector("#home-daily-fill"),
homeSpecimen: document.querySelector("#home-specimen"),
homeSpecimenImage: document.querySelector("#home-specimen-image"),
homeSpecimenImageStatus: document.querySelector("#home-specimen-image-status"),
homeSpecimenImageProgress: document.querySelector("#home-specimen-image-progress"),
homeCarouselPagination: document.querySelector("#home-carousel-pagination"),
appLoadingProgress: document.querySelector("#app-loading-progress"),
offlineProgress: document.querySelector("#offline-progress"),
updateProgress: document.querySelector("#update-progress"),
sensitivityProgress: document.querySelector("#sensitivity-loading-progress"),
workshopProgress: document.querySelector("#workshop-loading-progress"),
importProgress: document.querySelector("#import-progress"),
homeSpecimenName: document.querySelector("#home-specimen-name"),
homeSpecimenFamily: document.querySelector("#home-specimen-family"),
workbench: document.querySelector(".workbench"),
roundConfig: document.querySelector(".round-config"),
goalScope: document.querySelector("#goal-scope"),
goalGroup: document.querySelector("#goal-group"),
goalGroupLabel: document.querySelector("#goal-group-label"),
goalSummary: document.querySelector("#goal-summary"),
roundStart: document.querySelector("#round-start"),
roundResult: document.querySelector("#round-result"),
roundResultTitle: document.querySelector("#round-result-title"),
roundResultDetail: document.querySelector("#round-result-detail"),
timedQuizReviewPanel: document.querySelector("#timed-quiz-review-panel"),
timedQuizReview: document.querySelector("#timed-quiz-review"),
leaveRoundButton: document.querySelector("#leave-round-button"),
startRoundButton: document.querySelector("#start-round-button"),
newRoundButton: document.querySelector("#new-round-button"),
question: document.querySelector("#question-title"),
hint: document.querySelector("#question-hint"),
modes: [...document.querySelectorAll(".mode-button")],
modeDescription: document.querySelector("#mode-description"),
matchingVariants: document.querySelector("#matching-variants"),
answerArea: document.querySelector("#answer-area"),
feedback: document.querySelector("#feedback"),
next: document.querySelector("#next-button"),
source: document.querySelector("#source-link"),
sequence: document.querySelector("#exercise-sequence"),
timedQuizStatus: document.querySelector("#timed-quiz-status"),
timedQuizTimer: document.querySelector("#timed-quiz-timer"),
timedQuizScore: document.querySelector("#timed-quiz-score"),
timedQuizTier: document.querySelector("#timed-quiz-tier"),
bookmark: document.querySelector("#bookmark-button"),
progressSummary: document.querySelector("#progress-summary"),
progressTrack: document.querySelector(".progress-track"),
progressFill: document.querySelector("#progress-track-fill"),
progressCount: document.querySelector("#progress-count"),
difficult: document.querySelector("#difficult-list"),
collectionCount: document.querySelector("#collection-count"),
moreDetails: document.querySelector(".more-details"),
collectionSection: document.querySelector("#collection-section"),
collectionSearch: document.querySelector("#collection-search"),
collectionStatus: document.querySelector("#collection-status"),
collectionList: document.querySelector("#collection-list"),
collectorSection: document.querySelector("#collection-progress"),
collectorSummary: document.querySelector("#collector-summary"),
preserveStreakButton: document.querySelector("#preserve-streak-button"),
streakFeedback: document.querySelector("#streak-feedback"),
ownedStoneList: document.querySelector("#owned-stone-list"),
rankName: document.querySelector("#rank-name"),
ownedCount: document.querySelector("#owned-count"),
facetTrack: document.querySelector("#facet-track"),
rankLadder: document.querySelector("#rank-ladder"),
dailyExpeditionCopy: document.querySelector("#daily-expedition-copy"),
dailyExpeditionFill: document.querySelector("#daily-expedition-fill"),
weeklyExpeditionCopy: document.querySelector("#weekly-expedition-copy"),
weeklyExpeditionFill: document.querySelector("#weekly-expedition-fill"),
sealList: document.querySelector("#seal-list"),
gamificationToggle: document.querySelector("#gamification-toggle"),
soundToggle: document.querySelector("#sound-toggle"),
exportButton: document.querySelector("#export-button"),
importFile: document.querySelector("#import-file"),
resetButton: document.querySelector("#reset-button"),
dataFeedback: document.querySelector("#data-feedback"),
sensitivitySearch: document.querySelector("#sensitivity-search"),
sensitivityTableBody: document.querySelector("#sensitivity-table-body"),
sensitivityStatus: document.querySelector("#sensitivity-status"),
workshopSensitivitySearch: document.querySelector("#workshop-sensitivity-search"),
workshopSensitivityTableBody: document.querySelector("#workshop-sensitivity-table-body"),
workshopSensitivityStatus: document.querySelector("#workshop-sensitivity-status"),
photoPackStatus: document.querySelector("#photo-pack-status"),
photoPackProgress: document.querySelector("#photo-pack-progress"),
downloadPhotoPackButton: document.querySelector("#download-photo-pack-button"),
photoVarietyToggle: document.querySelector("#photo-variety-toggle"),
appVersion: document.querySelector("#app-version"),
settingsAppVersion: document.querySelector("#settings-app-version"),
checkUpdatesButton: document.querySelector("#check-updates-button"),
updateFeedback: document.querySelector("#update-feedback"),
};
let storageAvailable = true;
let state = StateStore.freshState();
let updateReady = false;
let versionLoading = false;
let updateCheckInProgress = false;
let updateInstalling = false;
let updateInstallFailed = false;
let updateProgressTotal = 0;
let updateFeedbackKey = "";
let appVersion = "1.3.9";
let hasActiveServiceWorker = false;
let feedbackAudioContext = null;
let lastPointerType = "keyboard";
const FEEDBACK_SOUND_CUES = {
click: [[740, 0, 0.045, 0.012]],
correct: [[660, 0, 0.1, 0.035], [880, 0.11, 0.14, 0.035]],
incorrect: [[330, 0, 0.11, 0.024], [247, 0.13, 0.14, 0.022]],
"lesson-complete": [[523, 0, 0.12, 0.032], [659, 0.12, 0.12, 0.032], [784, 0.24, 0.2, 0.032]],
"quiz-complete": [[784, 0, 0.11, 0.032], [988, 0.12, 0.13, 0.032], [1175, 0.25, 0.22, 0.036]],
};
const HAPTIC_PATTERNS = {
correct: [24, 35, 28],
incorrect: [48, 30, 48],
"lesson-complete": [25, 30, 55],
"quiz-complete": [20, 25, 20, 30, 60],
};
try {
const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) || "null");
if (saved) {
state = StateStore.normalizeState(saved);
if (saved.schemaVersion !== StateStore.VERSION) {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
} catch {
storageAvailable = false;
}
}
}
} catch {
storageAvailable = false;
state = StateStore.freshState();
}
let gemstones = [];
let currentGem = null;
let hasAnswered = false;
let answerRevealed = false;
let reviewFallback = false;
let sessionNumber = 0;
let roundActive = false;
let roundAnswered = 0;
let roundCorrect = 0;
const ROUND_LENGTH = 10;
let roundLength = ROUND_LENGTH;
let roundQueue = [];
let timedQuizCycle = null;
let timedQuizCountdown = null;
let timedQuizReview = [];
let roundMasteredStart = 0;
let roundSealsStart = 0;
let roundRankStart = 0;
let roundFavoriteTarget = new Set();
let roundFavoriteCorrect = new Set();
let roundFavoriteErrors = new Set();
let matchData = null;
let matchSelectedId = null;
let deferredInstallPrompt = null;
let offlineStatusKind = "checking";
let offlineMissingCount = 0;
let offlineWorker = null;
let photoPackTotal = 0;
let photoPackCached = 0;
let photoPackDownloading = false;
let photoPackChecking = false;
let photoPackCheckCompleted = 0;
let featuredGemId = null;
let homeCarouselGemIds = [];
let homeCarouselIndex = 0;
const recentImageByGem = new Map();
const selectedImageByGem = new Map();
let sensitivityRows = [];
let workshopSensitivityRows = [];
let workshopSensitivityColumns = [];
function persist() {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
storageAvailable = true;
} catch {
storageAvailable = false;
}
if (!storageAvailable) showFeedback(translationsFor("storageError"), "note");
renderProgress();
}
function todayKey(date = new Date()) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
function translate(key, values = {}) {
let text = translationsFor(key);
for (const [name, value] of Object.entries(values)) {
text = text.replaceAll(`{${name}}`, String(value));
}
return text;
}
function setTopbarMenuOpen(open, { restoreFocus = false } = {}) {
const isOpen = Boolean(open && window.matchMedia("(max-width: 1016px)").matches);
ui.topbar.classList.toggle("is-menu-open", isOpen);
ui.topbarMenuButton.setAttribute("aria-expanded", String(isOpen));
ui.topbarMenuButton.setAttribute("aria-label", translationsFor(isOpen ? "closeNavigation" : "openNavigation"));
closeTopbarPanels();
if (restoreFocus) ui.topbarMenuButton.focus();
}
function closeTopbarPanels() {
ui.topbarPanels.forEach((panel) => {
panel.classList.remove("is-open");
panel.querySelector("[aria-controls]")?.setAttribute("aria-expanded", "false");
panel.querySelector(".topbar-popover")?.setAttribute("aria-hidden", "true");
});
}
function setTopbarPanelOpen(panel, open) {
if (open) closeTopbarPanels();
panel.classList.toggle("is-open", open);
panel.querySelector("[aria-controls]")?.setAttribute("aria-expanded", String(open));
panel.querySelector(".topbar-popover")?.setAttribute("aria-hidden", String(!open));
}
function syncTopbarCurrentLink(hash = window.location.hash || "#home-config") {
ui.topbarNav.querySelectorAll(".topbar-link").forEach((link) => {
if (link.hash === hash) {
link.setAttribute("aria-current", "location");
} else {
link.removeAttribute("aria-current");
}
});
}
function renderAppVersion() {
[ui.appVersion, ui.settingsAppVersion].forEach((element) => {
element.textContent = `v${appVersion}`;
element.setAttribute("aria-label", translate("versionLabel", { version: appVersion }));
});
}
function applyLanguage() {
document.documentElement.lang = state.language;
document.title = state.language === "de" ? "Lernstein — Edelsteine lernen" : "Lernstein — Learn gemstones";
document.querySelector('meta[name="description"]').content = translationsFor("metaDescription");
document.querySelectorAll("[data-copy]").forEach((element) => {
element.textContent = translationsFor(element.dataset.copy);
});
document.querySelectorAll("[data-placeholder]").forEach((element) => {
element.placeholder = translationsFor(element.dataset.placeholder);
});
document.querySelectorAll("[data-aria-copy]").forEach((element) => {
element.setAttribute("aria-label", translationsFor(element.dataset.ariaCopy));
});
setTopbarMenuOpen(ui.topbarMenuButton.getAttribute("aria-expanded") === "true");
ui.checkUpdatesButton.querySelector(".update-label").textContent = translationsFor(updateReady ? "reloadApp" : "checkUpdates");
ui.checkUpdatesButton.querySelector(".update-short").textContent = translationsFor(updateReady ? "reloadAppShort" : "updateShort");
ui.checkUpdatesButton.setAttribute("aria-label", translationsFor(updateReady ? "reloadApp" : "checkUpdates"));
ui.updatePanelTrigger.setAttribute("aria-label", translationsFor(updateReady ? "reloadApp" : "checkUpdates"));
if (updateFeedbackKey) ui.updateFeedback.textContent = translationsFor(updateFeedbackKey);
renderAppVersion();
ui.languageButton.textContent = state.language === "de" ? "EN" : "DE";
ui.languageButton.setAttribute("aria-label", state.language === "de" ? "Switch to English" : "Zu Deutsch wechseln");
ui.installButton.setAttribute("aria-label", translationsFor("install"));
ui.installPanelTrigger.setAttribute("aria-label", translationsFor("install"));
ui.soundToggle.checked = state.soundEnabled;
refreshOfflineStatusCopy();
ui.installDialogCopy.textContent = /Firefox\//i.test(navigator.userAgent)
? translationsFor("installFirefoxHint")
: translationsFor("installOtherHint");
ui.themeButton.setAttribute(
"aria-label",
state.theme === "dark"
? (state.language === "de" ? "Hellmodus aktivieren" : "Switch to light mode")
: (state.language === "de" ? "Dunkelmodus aktivieren" : "Switch to dark mode"),
);
ui.collectionSearch.setAttribute("aria-label", translationsFor("searchLabel"));
document.querySelector(".learning-tabs").setAttribute("aria-label", translationsFor("ariaLearningAreas"));
document.querySelector(".mode-picker").setAttribute("aria-label", translationsFor("ariaPracticeModes"));
document.querySelector(".mode-picker").setAttribute("aria-describedby", "mode-description");
updateModeDescription();
ui.progressTrack.setAttribute("aria-label", translationsFor("ariaDailyProgress"));
document.querySelector("#gem-fallback").setAttribute("aria-label", translationsFor("gemAlt"));
ui.colorSwatches.setAttribute("aria-label", translationsFor("knownColors"));
document.querySelectorAll(".image-loading-progress").forEach((progress) => {
progress.setAttribute("aria-label", translationsFor("loadingImageProgress"));
});
if (!ui.updateProgress.hidden) {
if (ui.updateProgress.hasAttribute("value")) {
setUpdateProgress(Number(ui.updateProgress.value), Number(ui.updateProgress.max));
} else {
setUpdateProgress();
}
}
if (photoPackTotal > 0) {
updatePhotoPackUI(photoPackDownloading ? "loading" : photoPackChecking ? "checking" : "status");
}
updateHomeSpecimenImageState();
setOfflineStatus(offlineStatusKind);
}
function setTheme() {
document.documentElement.dataset.theme = state.theme;
const themeColor = document.querySelector('meta[name="theme-color"]');
themeColor.content = state.theme === "dark" ? "#241b16" : "#f5efe5";
applyLanguage();
}
function normalizeAnswer(value) {
return String(value || "")
.normalize("NFKD")
.replace(/[\u0300-\u036f]/g, "")
.toLowerCase()
.replace(/[’']/g, "")
.replace(/[^\p{L}\p{N}]+/gu, " ")
.trim()
.replace(/\s+/g, " ");
}
function capitalizeName(value) {
const text = String(value || "").trim();
return text ? text.charAt(0).toLocaleUpperCase(state.language) + text.slice(1) : text;
}
function getPropertyLabel(property = state.property) {
const option = propertyOptions.find(([key]) => key === property);
if (property === "hardness") return translationsFor("propertyHardness");
return option ? translationsFor(option[1]) : property;
}