pokeductor 0.7.0

A terminal Pokedex and evolution analyzer with sprite rendering, offline type and party analysis, and an on-disk cache for offline use
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
//! Localization layer.
//!
//! Every user-facing string flows through [`Language::strings`]. Because the UI
//! re-reads these on every frame, switching language (the `L` hotkey) updates
//! the entire interface instantly with no extra bookkeeping.

use crate::models::{title_case, EvolutionCondition, EvolutionTrigger, StatKind};

/// Supported interface languages.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Language {
    English,
    Turkish,
    German,
    French,
    Spanish,
    Italian,
}

impl Language {
    /// Every supported language, in picker order.
    pub const ALL: [Language; 6] = [
        Language::English,
        Language::Turkish,
        Language::German,
        Language::French,
        Language::Spanish,
        Language::Italian,
    ];

    /// Position of this language within [`Language::ALL`].
    pub fn index(self) -> usize {
        Language::ALL.iter().position(|&l| l == self).unwrap_or(0)
    }

    /// Endonym shown in the language picker, e.g. `"Türkçe"`.
    pub fn label(self) -> &'static str {
        match self {
            Language::English => "English",
            Language::Turkish => "Türkçe",
            Language::German => "Deutsch",
            Language::French => "Français",
            Language::Spanish => "Español",
            Language::Italian => "Italiano",
        }
    }

    /// PokeAPI language code used to pick localized flavor/genus text. PokeAPI
    /// has no Turkish entries, so Turkish maps to `"tr"` and falls back to
    /// English at the point of use.
    pub fn flavor_code(self) -> &'static str {
        match self {
            Language::English => "en",
            Language::Turkish => "tr",
            Language::German => "de",
            Language::French => "fr",
            Language::Spanish => "es",
            Language::Italian => "it",
        }
    }

    /// The inverse of [`flavor_code`](Self::flavor_code), for reading a
    /// language back out of a stored session. An unknown code — a file written
    /// by a build that shipped a language this one does not — is `None`, and
    /// the caller keeps its default rather than failing.
    pub fn from_code(code: &str) -> Option<Language> {
        Language::ALL
            .into_iter()
            .find(|language| language.flavor_code() == code)
    }

    /// Short tag shown in the status bar, e.g. `EN`.
    pub fn tag(self) -> &'static str {
        match self {
            Language::English => "EN",
            Language::Turkish => "TR",
            Language::German => "DE",
            Language::French => "FR",
            Language::Spanish => "ES",
            Language::Italian => "IT",
        }
    }

    /// The full translation table for this language.
    pub fn strings(self) -> Strings {
        match self {
            Language::English => Strings::english(),
            Language::Turkish => Strings::turkish(),
            Language::German => Strings::german(),
            Language::French => Strings::french(),
            Language::Spanish => Strings::spanish(),
            Language::Italian => Strings::italian(),
        }
    }

    /// Localized label for a single base stat.
    pub fn stat_label(self, kind: StatKind) -> &'static str {
        let s = self.strings();
        match kind {
            StatKind::Hp => s.stat_hp,
            StatKind::Attack => s.stat_attack,
            StatKind::Defense => s.stat_defense,
            StatKind::SpecialAttack => s.stat_sp_attack,
            StatKind::SpecialDefense => s.stat_sp_defense,
            StatKind::Speed => s.stat_speed,
        }
    }

    /// A type's name in this language, for a PokeAPI type slug. A slug the
    /// table does not know (`stellar`, `shadow`) is title-cased as it comes.
    pub fn type_name(self, slug: &str) -> String {
        TYPE_NAMES
            .iter()
            .find(|(known, _)| *known == slug)
            .map(|(_, names)| names[self.index()].to_string())
            .unwrap_or_else(|| title_case(slug))
    }
}

/// Every type's name in each language, in [`Language::ALL`] order.
///
/// Written out here rather than fetched: PokeAPI has these for every language
/// but Turkish, but the type is on nearly every card, and eighteen fixed words
/// are not worth a request and a cache entry each. The Turkish names are the
/// ones Turkish fan communities settled on, since the games were never
/// released in Turkish.
const TYPE_NAMES: [(&str, [&str; 6]); 18] = [
    (
        "normal",
        ["Normal", "Normal", "Normal", "Normal", "Normal", "Normale"],
    ),
    ("fire", ["Fire", "Ateş", "Feuer", "Feu", "Fuego", "Fuoco"]),
    ("water", ["Water", "Su", "Wasser", "Eau", "Agua", "Acqua"]),
    (
        "electric",
        [
            "Electric",
            "Elektrik",
            "Elektro",
            "Électrik",
            "Eléctrico",
            "Elettro",
        ],
    ),
    (
        "grass",
        ["Grass", "Çimen", "Pflanze", "Plante", "Planta", "Erba"],
    ),
    ("ice", ["Ice", "Buz", "Eis", "Glace", "Hielo", "Ghiaccio"]),
    (
        "fighting",
        ["Fighting", "Dövüş", "Kampf", "Combat", "Lucha", "Lotta"],
    ),
    (
        "poison",
        ["Poison", "Zehir", "Gift", "Poison", "Veneno", "Veleno"],
    ),
    (
        "ground",
        ["Ground", "Yer", "Boden", "Sol", "Tierra", "Terra"],
    ),
    (
        "flying",
        ["Flying", "Uçan", "Flug", "Vol", "Volador", "Volante"],
    ),
    (
        "psychic",
        ["Psychic", "Psişik", "Psycho", "Psy", "Psíquico", "Psico"],
    ),
    (
        "bug",
        ["Bug", "Böcek", "Käfer", "Insecte", "Bicho", "Coleottero"],
    ),
    (
        "rock",
        ["Rock", "Kaya", "Gestein", "Roche", "Roca", "Roccia"],
    ),
    (
        "ghost",
        [
            "Ghost", "Hayalet", "Geist", "Spectre", "Fantasma", "Spettro",
        ],
    ),
    (
        "dragon",
        ["Dragon", "Ejderha", "Drache", "Dragon", "Dragón", "Drago"],
    ),
    (
        "dark",
        [
            "Dark",
            "Karanlık",
            "Unlicht",
            "Ténèbres",
            "Siniestro",
            "Buio",
        ],
    ),
    (
        "steel",
        ["Steel", "Çelik", "Stahl", "Acier", "Acero", "Acciaio"],
    ),
    ("fairy", ["Fairy", "Peri", "Fee", "Fée", "Hada", "Folletto"]),
];

/// The type slug a typed name stands for, in any of the six languages.
///
/// Any language rather than only the current one: someone who has learned
/// `type:geist` keeps it after switching the interface to English, and no
/// two languages use one word for different types, so nothing is ambiguous.
/// Accents are optional, because `type:electrik` is what a keyboard without
/// them produces.
pub fn type_slug(typed: &str) -> Option<&'static str> {
    let typed = fold(typed);
    TYPE_NAMES
        .iter()
        .find(|(slug, names)| *slug == typed || names.iter().any(|name| fold(name) == typed))
        .map(|(slug, _)| *slug)
}

/// Lowercases `text` and strips the accents the type names use, so a name
/// typed with or without them compares equal.
fn fold(text: &str) -> String {
    text.chars()
        .flat_map(char::to_lowercase)
        .map(|c| match c {
            'á' | 'à' | 'â' | 'ä' => 'a',
            'é' | 'è' | 'ê' | 'ë' => 'e',
            'í' | 'ì' | 'î' | 'ï' | 'ı' => 'i',
            'ó' | 'ò' | 'ô' | 'ö' => 'o',
            'ú' | 'ù' | 'û' | 'ü' => 'u',
            'ç' => 'c',
            'ğ' => 'g',
            'ñ' => 'n',
            'ş' => 's',
            other => other,
        })
        .collect()
}

/// A fully populated set of UI strings. Using a struct of `&'static str` keeps
/// translations explicit and lets the compiler catch any missing field.
#[derive(Debug, Clone, Copy)]
pub struct Strings {
    pub app_title: &'static str,
    pub sidebar_title: &'static str,
    pub search_title: &'static str,
    pub details_title: &'static str,
    pub evolution_title: &'static str,
    pub loading: &'static str,
    pub loading_list: &'static str,
    pub no_selection: &'static str,
    pub no_results: &'static str,
    pub no_evolution: &'static str,
    pub types_label: &'static str,
    pub height_label: &'static str,
    pub weight_label: &'static str,
    pub total_label: &'static str,
    /// Labels for the field-guide rows on the info card.
    pub egg_groups_label: &'static str,
    /// A species with no gender. The gendered case is written in symbols and
    /// needs no label.
    pub genderless: &'static str,
    pub catch_rate_label: &'static str,
    /// The catch rate in words, shown beside the number so it says which way
    /// the scale runs.
    pub catch_hard: &'static str,
    pub catch_average: &'static str,
    pub catch_easy: &'static str,
    pub growth_label: &'static str,
    pub happiness_label: &'static str,
    pub habitat_label: &'static str,
    pub error_prefix: &'static str,
    pub stat_hp: &'static str,
    pub stat_attack: &'static str,
    pub stat_defense: &'static str,
    pub stat_sp_attack: &'static str,
    pub stat_sp_defense: &'static str,
    pub stat_speed: &'static str,
    /// The one-line status bar. Deliberately short: the full key map lives in
    /// the help overlay, so this only carries what a first-time reader needs
    /// to find it.
    pub help: &'static str,
    /// Placeholder shown in an empty, unfocused search box. Doubles as the
    /// only place the `dex:` / `type:` / `gen:` syntax is advertised, so it
    /// names them literally — those keywords are not translated.
    pub search_hint: &'static str,
    /// Sidebar sort-order badges.
    pub sort_dex: &'static str,
    pub sort_name: &'static str,
    pub sort_total: &'static str,
    pub sort_speed: &'static str,
    /// Shown in the list while a `type:` filter waits on its roster.
    pub loading_filter: &'static str,
    /// Title of the team card.
    pub team_title: &'static str,
    /// Shown on the team card while the party is empty.
    pub team_empty: &'static str,
    /// Heading above the attacking types that hit several members hard.
    pub team_shared_weak: &'static str,
    /// Heading above the attacking types nobody on the team resists.
    pub team_unresisted: &'static str,
    /// Heading above the defending types nobody on the team hits hard.
    pub team_offense_gaps: &'static str,
    /// Reassurance shown in place of an empty weakness/gap section.
    pub team_all_clear: &'static str,
    /// Heading above the immunities a Pokemon's abilities grant — on the party
    /// card and on the single-species matchup card alike, since both report
    /// them and neither should word it differently.
    pub immune_by_ability: &'static str,
    /// Abbreviation for "generation", put before a roman numeral in the titles
    /// of the cards that read a generation's type rules: `Gen I`.
    pub generation_tag: &'static str,
    /// Said of a species that was not in the games of the generation a card
    /// is reading, in place of an answer for it.
    pub absent_from_generation: &'static str,
    /// Marker on an immunity the species might not actually have, because the
    /// ability granting it is only one of several it could carry.
    pub immunity_maybe: &'static str,
    /// Hint at the foot of the team card. Carries the card's own keys, since
    /// it is the one overlay with a cursor and a binding beyond closing.
    pub team_close_hint: &'static str,
    /// Replaces the hint for a moment once `E` has copied the party.
    pub team_copied: &'static str,
    /// Label for the ability row on the info card.
    pub abilities_label: &'static str,
    /// Title of the ability card.
    pub abilities_title: &'static str,
    /// Marker on a species' hidden ability.
    pub ability_hidden: &'static str,
    /// Hint at the foot of the ability card.
    pub ability_close_hint: &'static str,
    /// Title of the moves card.
    pub moves_title: &'static str,
    /// Shown in place of the list when a species has no recorded learnset.
    pub moves_empty: &'static str,
    /// Hint at the foot of the moves card.
    pub moves_close_hint: &'static str,
    /// Title of the stat calculator card.
    pub calc_title: &'static str,
    /// Row labels and column headings on the calculator. "IV" and "EV" are
    /// written the same in every language and are not here.
    pub calc_level: &'static str,
    pub calc_nature: &'static str,
    pub calc_base: &'static str,
    pub calc_stat: &'static str,
    /// Hint at the foot of the calculator card.
    pub calc_hint: &'static str,
    /// Label for the alternate-forms row on the info card.
    pub forms_label: &'static str,
    /// Title of the forms card.
    pub forms_title: &'static str,
    /// Hint at the foot of the forms card, which has a cursor and a jump of
    /// its own.
    pub forms_close_hint: &'static str,
    /// Column headings on the moves card. Kept short: seven columns have to
    /// fit a card narrow enough to leave the list behind it visible.
    pub col_learn: &'static str,
    pub col_move: &'static str,
    pub col_type: &'static str,
    pub col_category: &'static str,
    pub col_power: &'static str,
    pub col_accuracy: &'static str,
    pub col_pp: &'static str,
    /// What stands in the level column for a move no level is learned at.
    pub learn_machine: &'static str,
    pub learn_egg: &'static str,
    pub learn_tutor: &'static str,
    /// A move's damage category.
    pub class_physical: &'static str,
    pub class_special: &'static str,
    pub class_status: &'static str,
    /// Hint shown in the evolution panel when it is not focused.
    pub expand_hint: &'static str,
    /// Hint shown in the evolution panel while it is focused.
    pub evo_nav_hint: &'static str,
    /// Hint at the foot of the full-screen evolution view.
    pub evo_card_hint: &'static str,
    /// Placeholder under a chain member whose sprite is still loading.
    pub sprite_loading: &'static str,
    /// Title of the language-picker card.
    pub language_title: &'static str,
    /// Title of the type-matchup card.
    pub matchups_title: &'static str,
    /// Heading above the "damage this Pokemon takes" groups.
    pub matchups_defense: &'static str,
    /// Heading above the types this Pokemon hits super-effectively.
    pub matchups_offense: &'static str,
    /// Shown in place of an empty matchup group.
    pub matchups_none: &'static str,
    /// Hint at the foot of the matchup card.
    pub close_hint: &'static str,
    /// Title of the head-to-head comparison card.
    pub compare_title: &'static str,
    /// Heading above the two best same-type hits on the comparison card.
    pub compare_best_hit: &'static str,
    /// Shown in a comparison row the two species are level on.
    pub compare_tie: &'static str,
    /// Hint at the foot of the comparison card.
    pub compare_hint: &'static str,
    /// Wording for the help overlay.
    pub help_card: HelpStrings,
    /// Wording for evolution requirements.
    pub evo: EvoStrings,
    /// Badge labels for special species categories.
    pub legendary_label: &'static str,
    pub mythical_label: &'static str,
    pub baby_label: &'static str,
    /// Badge marking the info card while shiny artwork is on display.
    pub shiny_label: &'static str,
}

/// Labels for the help overlay.
///
/// Kept in its own struct because it is a table rather than a handful of
/// captions: the key names are language-neutral and live in `ui.rs`, while
/// every action label is translated here.
#[derive(Debug, Clone, Copy)]
pub struct HelpStrings {
    pub title: &'static str,
    pub ctx_list: &'static str,
    pub ctx_search: &'static str,
    pub ctx_evolution: &'static str,
    /// The party card, which has a cursor and a binding of its own.
    pub ctx_party: &'static str,
    /// The forms card, which likewise has a cursor and a jump.
    pub ctx_forms: &'static str,
    pub ctx_cards: &'static str,
    pub act_move: &'static str,
    pub act_jump10: &'static str,
    pub act_load: &'static str,
    pub act_search: &'static str,
    pub act_evolutions: &'static str,
    pub act_types: &'static str,
    pub act_abilities: &'static str,
    pub act_moves: &'static str,
    /// `I`: the stat calculator.
    pub act_stat_calc: &'static str,
    /// `V`: the species' alternate forms.
    pub act_forms: &'static str,
    pub act_shiny: &'static str,
    /// `R`: a random species out of whatever the list is narrowed to.
    pub act_random: &'static str,
    pub act_party_toggle: &'static str,
    /// `B`: mark or unmark the highlighted species as a favourite.
    pub act_favourite: &'static str,
    pub act_party_card: &'static str,
    pub act_sort: &'static str,
    pub act_language: &'static str,
    /// `g` / `G`: step the generation the type cards read.
    pub act_generation: &'static str,
    pub act_help: &'static str,
    pub act_quit: &'static str,
    pub act_load_back: &'static str,
    pub act_back: &'static str,
    pub act_by_type: &'static str,
    pub act_by_ability: &'static str,
    pub act_by_egg: &'static str,
    pub act_by_generation: &'static str,
    /// `fav:`: only the species marked with `B`.
    pub act_by_favourite: &'static str,
    /// `spe>=100`: a comparison on a base stat.
    pub act_by_stat: &'static str,
    pub act_chain_move: &'static str,
    pub act_chain_jump: &'static str,
    pub act_form_jump: &'static str,
    pub act_chain_expand: &'static str,
    pub act_compare: &'static str,
    /// `E` on the party card: copy it as a Showdown team.
    pub act_copy_team: &'static str,
    pub act_close: &'static str,
    pub close_hint: &'static str,
}

/// Wording for the requirements attached to an evolution.
///
/// Entries containing `{}` are templates: the placeholder is replaced with a
/// value (a level, an item, a species), which lets each language put it where
/// its grammar wants it — "Use Water Stone" vs. "Water Stone kullan".
///
/// Item, move and location names themselves stay in English: they arrive as
/// PokeAPI slugs and localizing them would mean an extra request per name.
#[derive(Debug, Clone, Copy)]
pub struct EvoStrings {
    pub level: &'static str,
    pub level_up: &'static str,
    pub trade: &'static str,
    pub trade_with: &'static str,
    pub use_item: &'static str,
    pub held_item: &'static str,
    pub knows_move: &'static str,
    pub knows_move_type: &'static str,
    pub happiness: &'static str,
    pub affection: &'static str,
    pub beauty: &'static str,
    pub day: &'static str,
    pub night: &'static str,
    pub dusk: &'static str,
    pub location: &'static str,
    pub male: &'static str,
    pub female: &'static str,
    pub rain: &'static str,
    pub upside_down: &'static str,
    pub party_species: &'static str,
    pub party_type: &'static str,
    pub shed: &'static str,
}

impl EvoStrings {
    /// Every requirement in `condition`, phrased for this language and ordered
    /// most-identifying first — so callers with little room can simply take the
    /// first entry and still show the part that matters.
    pub fn parts(&self, condition: &EvolutionCondition) -> Vec<String> {
        let fill = |template: &str, value: &str| template.replace("{}", value);
        let mut parts = Vec::new();

        if let Some(level) = condition.min_level {
            parts.push(fill(self.level, &level.to_string()));
        }
        if let Some(item) = &condition.item {
            parts.push(fill(self.use_item, &title_case(item)));
        }
        match (&condition.trigger, &condition.trade_species) {
            (Some(EvolutionTrigger::Trade), Some(species)) => {
                parts.push(fill(self.trade_with, &title_case(species)));
            }
            (Some(EvolutionTrigger::Trade), None) => parts.push(self.trade.to_string()),
            (Some(EvolutionTrigger::Shed), _) => parts.push(self.shed.to_string()),
            _ => {}
        }
        if let Some(item) = &condition.held_item {
            parts.push(fill(self.held_item, &title_case(item)));
        }
        if let Some(move_) = &condition.known_move {
            parts.push(fill(self.knows_move, &title_case(move_)));
        }
        if let Some(type_) = &condition.known_move_type {
            parts.push(fill(self.knows_move_type, &title_case(type_)));
        }
        if let Some(value) = condition.min_happiness {
            parts.push(fill(self.happiness, &value.to_string()));
        }
        if let Some(value) = condition.min_affection {
            parts.push(fill(self.affection, &value.to_string()));
        }
        if let Some(value) = condition.min_beauty {
            parts.push(fill(self.beauty, &value.to_string()));
        }
        if let Some(time) = condition.time_of_day.as_deref() {
            match time {
                "day" => parts.push(self.day.to_string()),
                "night" => parts.push(self.night.to_string()),
                "dusk" => parts.push(self.dusk.to_string()),
                other => parts.push(title_case(other)),
            }
        }
        if let Some(place) = &condition.location {
            parts.push(fill(self.location, &title_case(place)));
        }
        match condition.gender {
            Some(1) => parts.push(self.female.to_string()),
            Some(2) => parts.push(self.male.to_string()),
            _ => {}
        }
        if let Some(species) = &condition.party_species {
            parts.push(fill(self.party_species, &title_case(species)));
        }
        if let Some(type_) = &condition.party_type {
            parts.push(fill(self.party_type, &title_case(type_)));
        }
        if condition.needs_overworld_rain {
            parts.push(self.rain.to_string());
        }
        if condition.turn_upside_down {
            parts.push(self.upside_down.to_string());
        }
        // Tyrogue's three branches. Symbolic, so it reads the same everywhere.
        if let Some(cmp) = condition.relative_physical_stats {
            parts.push(match cmp {
                1 => "Atk > Def".to_string(),
                -1 => "Atk < Def".to_string(),
                _ => "Atk = Def".to_string(),
            });
        }

        // Nothing but a trigger: name the trigger rather than showing nothing.
        if parts.is_empty() {
            match &condition.trigger {
                Some(EvolutionTrigger::LevelUp) => parts.push(self.level_up.to_string()),
                Some(EvolutionTrigger::Other(slug)) => parts.push(title_case(slug)),
                _ => {}
            }
        }
        parts
    }

    /// Every requirement on one line, for the hint bar.
    pub fn summary(&self, condition: &EvolutionCondition) -> String {
        self.parts(condition).join(" · ")
    }

    /// Just the headline requirement, for the single row under a sprite card.
    pub fn short(&self, condition: &EvolutionCondition) -> Option<String> {
        self.parts(condition).into_iter().next()
    }
}

impl Strings {
    fn english() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex & Evolution Analyzer ",
            sidebar_title: " Pokemon ",
            search_title: " Search ",
            details_title: " Details ",
            evolution_title: " Evolution Chain ",
            loading: "Loading",
            loading_list: "Fetching Pokedex",
            no_selection: "Select a Pokemon and press Enter",
            no_results: "No Pokemon match your search",
            no_evolution: "No evolution data",
            types_label: "Types",
            height_label: "Height",
            weight_label: "Weight",
            total_label: "Total",
            egg_groups_label: "Egg groups",
            genderless: "Genderless",
            catch_rate_label: "Catch rate",
            catch_hard: "hard",
            catch_average: "average",
            catch_easy: "easy",
            growth_label: "Growth",
            happiness_label: "Happiness",
            habitat_label: "Habitat",
            error_prefix: "Error",
            stat_hp: "HP",
            stat_attack: "Attack",
            stat_defense: "Defense",
            stat_sp_attack: "Sp. Atk",
            stat_sp_defense: "Sp. Def",
            stat_speed: "Speed",
            help: " ↑/↓ Navigate · Enter Select · / Search · ? Help · Q Quit ",
            search_hint: "name · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "BST",
            sort_speed: "Speed",
            team_title: " Party ",
            team_empty: "Press Space in the list to add a Pokemon",
            team_shared_weak: "Shared weaknesses",
            team_unresisted: "Resisted by nobody",
            team_offense_gaps: "Hit hard by nobody",
            team_all_clear: "nothing — all covered",
            abilities_label: "Abilities",
            abilities_title: " Abilities ",
            ability_hidden: "hidden",
            ability_close_hint: "Esc / A to close",
            moves_title: " Moves ",
            moves_empty: "No learnset recorded",
            moves_close_hint: "↑ ↓ to browse · M / Esc to close",
            calc_title: " Stat calculator ",
            calc_level: "Level",
            calc_nature: "Nature",
            calc_base: "Base",
            calc_stat: "Stat",
            calc_hint: "↑ ↓ ← → Move · 0-9 + - Edit · R Reset · Esc Close",
            forms_label: "Forms",
            forms_title: " Forms ",
            forms_close_hint: "↑ ↓ Select · Enter Open · Esc / V to close",
            col_learn: "Lv",
            col_move: "Move",
            col_type: "Type",
            col_category: "Cat.",
            col_power: "Pow",
            col_accuracy: "Acc",
            col_pp: "PP",
            learn_machine: "TM",
            learn_egg: "Egg",
            learn_tutor: "Tutor",
            class_physical: "Phys",
            class_special: "Spec",
            class_status: "Stat",
            immune_by_ability: "Immune by ability",
            generation_tag: "Gen",
            absent_from_generation: "Not in these games",
            immunity_maybe: "possible",
            team_close_hint: "↑ ↓ Select · C Pin / compare · E Copy · Esc Close",
            team_copied: "Copied as a Showdown team",
            loading_filter: "Fetching the filter's list",
            expand_hint: "Press E to browse evolutions",
            evo_nav_hint: "←/→ Select · Enter Jump · F Full screen · Esc Back",
            evo_card_hint: "←/→ Select · Enter Jump · F / Esc Close",
            sprite_loading: "loading…",
            language_title: " Language ",
            matchups_title: " Type Matchups ",
            matchups_defense: "Damage taken",
            matchups_offense: "Super effective against",
            matchups_none: "nothing",
            close_hint: "g G Gen · Esc / T to close",
            compare_title: " Head to Head ",
            compare_best_hit: "Best same-type hit",
            compare_tie: "level",
            compare_hint: "g G Gen · Esc / C to close",
            help_card: HelpStrings {
                title: " Help ",
                ctx_list: "List",
                ctx_search: "Search box",
                ctx_evolution: "Evolution panel",
                ctx_party: "Party card",
                ctx_forms: "Forms card",
                ctx_cards: "Any card",
                act_move: "Move selection",
                act_jump10: "Jump ten",
                act_load: "Load",
                act_search: "Search",
                act_evolutions: "Evolutions",
                act_types: "Type matchups",
                act_abilities: "Abilities",
                act_moves: "Moves",
                act_stat_calc: "Stat calculator",
                act_forms: "Alternate forms",
                act_shiny: "Shiny artwork",
                act_random: "Random from the list",
                act_party_toggle: "Add / remove from party",
                act_favourite: "Mark / unmark favourite",
                act_party_card: "Party",
                act_sort: "Sort order",
                act_language: "Language",
                act_generation: "Generation of the type chart",
                act_help: "This help",
                act_quit: "Quit",
                act_load_back: "Load and return",
                act_back: "Back to list",
                act_by_type: "Filter by type",
                act_by_ability: "Filter by ability",
                act_by_egg: "Filter by egg group",
                act_by_generation: "Filter by generation",
                act_by_favourite: "Only favourites",
                act_by_stat: "Filter by base stat",
                act_chain_move: "Move between stages",
                act_chain_jump: "Jump to stage",
                act_form_jump: "Open form",
                act_chain_expand: "Full-screen chain",
                act_compare: "Pin / compare two species",
                act_copy_team: "Copy for Showdown",
                act_close: "Close",
                close_hint: "? / Esc to close",
            },
            evo: EvoStrings {
                level: "Lv. {}",
                level_up: "Level up",
                trade: "Trade",
                trade_with: "Trade for {}",
                use_item: "Use {}",
                held_item: "Holding {}",
                knows_move: "Knows {}",
                knows_move_type: "Knows a {} move",
                happiness: "Happiness {}",
                affection: "Affection {}",
                beauty: "Beauty {}",
                day: "Daytime",
                night: "At night",
                dusk: "At dusk",
                location: "At {}",
                male: "Male",
                female: "Female",
                rain: "In rain",
                upside_down: "Console upside down",
                party_species: "With {} in party",
                party_type: "With a {} type in party",
                shed: "Empty party slot",
            },
            legendary_label: "Legendary",
            mythical_label: "Mythical",
            baby_label: "Baby",
            shiny_label: "Shiny",
        }
    }

    fn turkish() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex ve Evrim Analizcisi ",
            sidebar_title: " Pokemonlar ",
            search_title: " Ara ",
            details_title: " Ayrıntılar ",
            evolution_title: " Evrim Zinciri ",
            loading: "Yükleniyor",
            loading_list: "Pokedex getiriliyor",
            no_selection: "Bir Pokemon seçip Enter'a basın",
            no_results: "Aramanızla eşleşen Pokemon yok",
            no_evolution: "Evrim verisi yok",
            types_label: "Türler",
            height_label: "Boy",
            weight_label: "Ağırlık",
            total_label: "Toplam",
            egg_groups_label: "Yumurta grupları",
            genderless: "Cinsiyetsiz",
            catch_rate_label: "Yakalama oranı",
            catch_hard: "zor",
            catch_average: "orta",
            catch_easy: "kolay",
            growth_label: "Gelişim",
            happiness_label: "Mutluluk",
            habitat_label: "Yaşam alanı",
            error_prefix: "Hata",
            stat_hp: "CAN",
            stat_attack: "Saldırı",
            stat_defense: "Savunma",
            stat_sp_attack: "Öz. Sal",
            stat_sp_defense: "Öz. Sav",
            stat_speed: "Hız",
            help: " ↑/↓ Gezin · Enter Seç · / Ara · ? Yardım · Q Çıkış ",
            search_hint: "isim · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "BST",
            sort_speed: "Hız",
            team_title: " Takım ",
            team_empty: "Listede Boşluk tuşuyla Pokemon ekleyin",
            team_shared_weak: "Ortak zayıflıklar",
            team_unresisted: "Kimsenin direnmediği",
            team_offense_gaps: "Kimsenin vuramadığı",
            team_all_clear: "yok — hepsi kapalı",
            abilities_label: "Yetenekler",
            abilities_title: " Yetenekler ",
            ability_hidden: "gizli",
            ability_close_hint: "Kapatmak için Esc / A",
            moves_title: " Hareketler ",
            moves_empty: "Kayıtlı hareket listesi yok",
            moves_close_hint: "↑ ↓ gezin · M / Esc kapat",
            calc_title: " Değer hesaplayıcı ",
            calc_level: "Seviye",
            calc_nature: "Doğa",
            calc_base: "Temel",
            calc_stat: "Sonuç",
            calc_hint: "↑ ↓ ← → Gezin · 0-9 + - Düzenle · R Sıfırla · Esc Kapat",
            forms_label: "Formlar",
            forms_title: " Formlar ",
            forms_close_hint: "↑ ↓ Seç · Enter Aç · Esc / V Kapat",
            col_learn: "Sv",
            col_move: "Hareket",
            col_type: "Tip",
            col_category: "Tür",
            col_power: "Güç",
            col_accuracy: "İsb",
            col_pp: "PP",
            learn_machine: "TM",
            learn_egg: "Yumurta",
            learn_tutor: "Öğretmen",
            class_physical: "Fiz",
            class_special: "Özel",
            class_status: "Durum",
            immune_by_ability: "Yetenekle bağışık",
            generation_tag: "Jen.",
            absent_from_generation: "Bu oyunlarda yok",
            immunity_maybe: "olası",
            team_close_hint: "↑ ↓ Seç · C Karşılaştır · E Kopyala · Esc Kapat",
            team_copied: "Showdown takımı olarak kopyalandı",
            loading_filter: "Filtre listesi getiriliyor",
            expand_hint: "Evrimlere göz atmak için E'ye basın",
            evo_nav_hint: "←/→ Seç · Enter Git · F Tam ekran · Esc Geri",
            evo_card_hint: "←/→ Seç · Enter Git · F / Esc Kapat",
            sprite_loading: "yükleniyor…",
            language_title: " Dil ",
            matchups_title: " Tip Etkinliği ",
            matchups_defense: "Alınan hasar",
            matchups_offense: "Karşı üstün olduğu tipler",
            matchups_none: "yok",
            close_hint: "g G Jen. · Kapatmak için Esc / T",
            compare_title: " Karşılaştırma ",
            compare_best_hit: "En sert aynı tipten vuruş",
            compare_tie: "eşit",
            compare_hint: "g G Jen. · Kapatmak için Esc / C",
            help_card: HelpStrings {
                title: " Yardım ",
                ctx_list: "Liste",
                ctx_search: "Arama kutusu",
                ctx_evolution: "Evrim paneli",
                ctx_party: "Takım kartı",
                ctx_forms: "Form kartı",
                ctx_cards: "Tüm kartlar",
                act_move: "Seçimi taşı",
                act_jump10: "On atla",
                act_load: "Yükle",
                act_search: "Ara",
                act_evolutions: "Evrimler",
                act_types: "Tip eşleşmeleri",
                act_abilities: "Yetenekler",
                act_moves: "Hareketler",
                act_stat_calc: "Değer hesaplayıcı",
                act_forms: "Alternatif formlar",
                act_shiny: "Parlak görsel",
                act_random: "Listeden rastgele",
                act_party_toggle: "Takıma ekle / çıkar",
                act_favourite: "Favorilere ekle / çıkar",
                act_party_card: "Takım",
                act_sort: "Sıralama",
                act_language: "Dil",
                act_generation: "Tip tablosunun jenerasyonu",
                act_help: "Bu yardım",
                act_quit: "Çıkış",
                act_load_back: "Yükle ve dön",
                act_back: "Listeye dön",
                act_by_type: "Tipe göre süz",
                act_by_ability: "Yeteneğe göre süz",
                act_by_egg: "Yumurta grubuna göre süz",
                act_by_generation: "Jenerasyona göre süz",
                act_by_favourite: "Sadece favoriler",
                act_by_stat: "Temel değere göre süz",
                act_chain_move: "Aşamalar arasında gez",
                act_chain_jump: "Aşamaya atla",
                act_form_jump: "Formu aç",
                act_chain_expand: "Zinciri tam ekran aç",
                act_compare: "Sabitle / iki türü karşılaştır",
                act_copy_team: "Showdown'a kopyala",
                act_close: "Kapat",
                close_hint: "Kapatmak için ? / Esc",
            },
            evo: EvoStrings {
                level: "Sv. {}",
                level_up: "Seviye atlayınca",
                trade: "Takas",
                trade_with: "{} ile takas",
                use_item: "{} kullan",
                held_item: "{} taşırken",
                knows_move: "{} bilir",
                knows_move_type: "{} tipi hamle bilir",
                happiness: "Mutluluk {}",
                affection: "Sevgi {}",
                beauty: "Güzellik {}",
                day: "Gündüz",
                night: "Gece",
                dusk: "Alacakaranlık",
                location: "{} bölgesinde",
                male: "Erkek",
                female: "Dişi",
                rain: "Yağmurda",
                upside_down: "Konsol ters çevrili",
                party_species: "Takımda {} varken",
                party_type: "Takımda {} tipi varken",
                shed: "Takımda boş yer",
            },
            legendary_label: "Efsanevi",
            mythical_label: "Mitik",
            baby_label: "Yavru",
            shiny_label: "Parlak",
        }
    }

    fn german() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex & Evolutions-Analyse ",
            sidebar_title: " Pokemon ",
            search_title: " Suche ",
            details_title: " Details ",
            evolution_title: " Entwicklungsreihe ",
            loading: "Lädt",
            loading_list: "Pokedex wird geladen",
            no_selection: "Wähle ein Pokemon und drücke Enter",
            no_results: "Keine Pokemon gefunden",
            no_evolution: "Keine Entwicklungsdaten",
            types_label: "Typen",
            height_label: "Größe",
            weight_label: "Gewicht",
            total_label: "Summe",
            egg_groups_label: "Ei-Gruppen",
            genderless: "Geschlechtslos",
            catch_rate_label: "Fangrate",
            catch_hard: "schwer",
            catch_average: "mittel",
            catch_easy: "leicht",
            growth_label: "Wachstum",
            happiness_label: "Freundschaft",
            habitat_label: "Lebensraum",
            error_prefix: "Fehler",
            stat_hp: "KP",
            stat_attack: "Angriff",
            stat_defense: "Verteid.",
            stat_sp_attack: "Sp. Ang",
            stat_sp_defense: "Sp. Vert",
            stat_speed: "Tempo",
            help: " ↑/↓ Navigieren · Enter Wählen · / Suche · ? Hilfe · Q Beenden ",
            search_hint: "Name · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "BST",
            sort_speed: "Tempo",
            team_title: " Team ",
            team_empty: "Leertaste in der Liste fügt ein Pokemon hinzu",
            team_shared_weak: "Gemeinsame Schwächen",
            team_unresisted: "Von niemandem resistiert",
            team_offense_gaps: "Von niemandem hart getroffen",
            team_all_clear: "nichts — alles abgedeckt",
            abilities_label: "Fähigkeiten",
            abilities_title: " Fähigkeiten ",
            ability_hidden: "versteckt",
            ability_close_hint: "Esc / A zum Schließen",
            moves_title: " Attacken ",
            moves_empty: "Keine Attacken verzeichnet",
            moves_close_hint: "↑ ↓ blättern · M / Esc schließt",
            calc_title: " Werte-Rechner ",
            calc_level: "Level",
            calc_nature: "Wesen",
            calc_base: "Basis",
            calc_stat: "Wert",
            calc_hint: "↑ ↓ ← → Wählen · 0-9 + - Ändern · R Neu · Esc Schließen",
            forms_label: "Formen",
            forms_title: " Formen ",
            forms_close_hint: "↑ ↓ Wählen · Enter Öffnen · Esc / V Schließen",
            col_learn: "Lv",
            col_move: "Attacke",
            col_type: "Typ",
            col_category: "Kat.",
            col_power: "Str",
            col_accuracy: "Gen",
            col_pp: "AP",
            learn_machine: "TM",
            learn_egg: "Ei",
            learn_tutor: "Lehrer",
            class_physical: "Phys",
            class_special: "Spez",
            class_status: "Stat",
            immune_by_ability: "Immun durch Fähigkeit",
            generation_tag: "Gen.",
            absent_from_generation: "In diesen Spielen nicht dabei",
            immunity_maybe: "möglich",
            team_close_hint: "↑ ↓ Wählen · C Anheften · E Kopieren · Esc Schließen",
            team_copied: "Als Showdown-Team kopiert",
            loading_filter: "Filterliste wird geladen",
            expand_hint: "Drücke E für die Entwicklungsreihe",
            evo_nav_hint: "←/→ Wählen · Enter Springen · F Vollbild · Esc Zurück",
            evo_card_hint: "←/→ Wählen · Enter Springen · F / Esc Schließen",
            sprite_loading: "lädt…",
            language_title: " Sprache ",
            matchups_title: " Typ-Effektivität ",
            matchups_defense: "Erlittener Schaden",
            matchups_offense: "Sehr effektiv gegen",
            matchups_none: "nichts",
            close_hint: "g G Gen. · Esc / T zum Schließen",
            compare_title: " Direktvergleich ",
            compare_best_hit: "Bester Treffer eigenen Typs",
            compare_tie: "gleich",
            compare_hint: "g G Gen. · Esc / C zum Schließen",
            help_card: HelpStrings {
                title: " Hilfe ",
                ctx_list: "Liste",
                ctx_search: "Suchfeld",
                ctx_evolution: "Entwicklungsfeld",
                ctx_party: "Teamkarte",
                ctx_forms: "Formenkarte",
                ctx_cards: "Alle Karten",
                act_move: "Auswahl bewegen",
                act_jump10: "Zehn springen",
                act_load: "Laden",
                act_search: "Suche",
                act_evolutions: "Entwicklungen",
                act_types: "Typ-Matchups",
                act_abilities: "Fähigkeiten",
                act_moves: "Attacken",
                act_stat_calc: "Werte-Rechner",
                act_forms: "Andere Formen",
                act_shiny: "Schillernde Grafik",
                act_random: "Zufällig aus der Liste",
                act_party_toggle: "Team hinzu / entfernen",
                act_favourite: "Favorit an / aus",
                act_party_card: "Team",
                act_sort: "Sortierung",
                act_language: "Sprache",
                act_generation: "Generation der Typentabelle",
                act_help: "Diese Hilfe",
                act_quit: "Beenden",
                act_load_back: "Laden und zurück",
                act_back: "Zurück zur Liste",
                act_by_type: "Nach Typ filtern",
                act_by_ability: "Nach Fähigkeit filtern",
                act_by_egg: "Nach Ei-Gruppe filtern",
                act_by_generation: "Nach Generation filtern",
                act_by_favourite: "Nur Favoriten",
                act_by_stat: "Nach Werten filtern",
                act_chain_move: "Zwischen Stufen",
                act_chain_jump: "Zur Stufe springen",
                act_form_jump: "Form öffnen",
                act_chain_expand: "Reihe im Vollbild",
                act_compare: "Anheften / zwei vergleichen",
                act_copy_team: "Showdown-Kopie",
                act_close: "Schließen",
                close_hint: "? / Esc zum Schließen",
            },
            evo: EvoStrings {
                level: "Lv. {}",
                level_up: "Levelaufstieg",
                trade: "Tausch",
                trade_with: "Tausch gegen {}",
                use_item: "{} benutzen",
                held_item: "{} tragend",
                knows_move: "Kennt {}",
                knows_move_type: "Kennt {}-Attacke",
                happiness: "Freundschaft {}",
                affection: "Zuneigung {}",
                beauty: "Schönheit {}",
                day: "Tagsüber",
                night: "Nachts",
                dusk: "In der Dämmerung",
                location: "Bei {}",
                male: "Männlich",
                female: "Weiblich",
                rain: "Bei Regen",
                upside_down: "Konsole umgedreht",
                party_species: "Mit {} im Team",
                party_type: "Mit {}-Typ im Team",
                shed: "Freier Teamplatz",
            },
            legendary_label: "Legendär",
            mythical_label: "Mysteriös",
            baby_label: "Baby",
            shiny_label: "Schillernd",
        }
    }

    fn french() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex & Analyseur d'Évolution ",
            sidebar_title: " Pokemon ",
            search_title: " Recherche ",
            details_title: " Détails ",
            evolution_title: " Chaîne d'Évolution ",
            loading: "Chargement",
            loading_list: "Chargement du Pokedex",
            no_selection: "Choisis un Pokemon et appuie sur Entrée",
            no_results: "Aucun Pokemon trouvé",
            no_evolution: "Pas de données d'évolution",
            types_label: "Types",
            height_label: "Taille",
            weight_label: "Poids",
            total_label: "Total",
            egg_groups_label: "Groupes d'Œuf",
            genderless: "Asexué",
            catch_rate_label: "Taux de capture",
            catch_hard: "difficile",
            catch_average: "moyen",
            catch_easy: "facile",
            growth_label: "Croissance",
            happiness_label: "Bonheur",
            habitat_label: "Habitat",
            error_prefix: "Erreur",
            stat_hp: "PV",
            stat_attack: "Attaque",
            stat_defense: "Défense",
            stat_sp_attack: "Att. Sp",
            stat_sp_defense: "Déf. Sp",
            stat_speed: "Vitesse",
            help: " ↑/↓ Naviguer · Entrée Choisir · / Recherche · ? Aide · Q Quitter ",
            search_hint: "nom · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "Total",
            sort_speed: "Vitesse",
            team_title: " Équipe ",
            team_empty: "Espace dans la liste pour ajouter un Pokemon",
            team_shared_weak: "Faiblesses communes",
            team_unresisted: "Résisté par personne",
            team_offense_gaps: "Frappé fort par personne",
            team_all_clear: "rien — tout est couvert",
            abilities_label: "Talents",
            abilities_title: " Talents ",
            ability_hidden: "caché",
            ability_close_hint: "Esc / A pour fermer",
            moves_title: " Capacités ",
            moves_empty: "Aucune capacité répertoriée",
            moves_close_hint: "↑ ↓ parcourir · M / Échap ferme",
            calc_title: " Calcul des stats ",
            calc_level: "Niveau",
            calc_nature: "Nature",
            calc_base: "Base",
            calc_stat: "Stat",
            calc_hint: "↑ ↓ ← → Choisir · 0-9 + - Modifier · R Effacer · Échap Fermer",
            forms_label: "Formes",
            forms_title: " Formes ",
            forms_close_hint: "↑ ↓ Choisir · Entrée Ouvrir · Esc / V Fermer",
            col_learn: "Niv",
            col_move: "Capacité",
            col_type: "Type",
            col_category: "Cat.",
            col_power: "Puis",
            col_accuracy: "Préc",
            col_pp: "PP",
            learn_machine: "CT",
            learn_egg: "Œuf",
            learn_tutor: "Tuteur",
            class_physical: "Phys",
            class_special: "Spé",
            class_status: "Statut",
            immune_by_ability: "Immunisé par talent",
            generation_tag: "Gén.",
            absent_from_generation: "Absent de ces jeux",
            immunity_maybe: "possible",
            team_close_hint: "↑ ↓ Choisir · C Comparer · E Copier · Esc Fermer",
            team_copied: "Copiée comme équipe Showdown",
            loading_filter: "Chargement du filtre",
            expand_hint: "Appuie sur E pour les évolutions",
            evo_nav_hint: "←/→ Choisir · Entrée Aller · F Plein écran · Esc Retour",
            evo_card_hint: "←/→ Choisir · Entrée Aller · F / Esc Fermer",
            sprite_loading: "chargement…",
            language_title: " Langue ",
            matchups_title: " Efficacité des Types ",
            matchups_defense: "Dégâts subis",
            matchups_offense: "Super efficace contre",
            matchups_none: "rien",
            close_hint: "g G Gén. · Esc / T pour fermer",
            compare_title: " Face à Face ",
            compare_best_hit: "Meilleure attaque de même type",
            compare_tie: "égalité",
            compare_hint: "g G Gén. · Esc / C pour fermer",
            help_card: HelpStrings {
                title: " Aide ",
                ctx_list: "Liste",
                ctx_search: "Recherche",
                ctx_evolution: "Panneau d'évolution",
                ctx_party: "Carte d'équipe",
                ctx_forms: "Carte des formes",
                ctx_cards: "Toute carte",
                act_move: "Déplacer la sélection",
                act_jump10: "Sauter dix",
                act_load: "Charger",
                act_search: "Rechercher",
                act_evolutions: "Évolutions",
                act_types: "Affinités de type",
                act_abilities: "Talents",
                act_moves: "Capacités",
                act_stat_calc: "Calcul des stats",
                act_forms: "Autres formes",
                act_shiny: "Illustration chromatique",
                act_random: "Au hasard dans la liste",
                act_party_toggle: "Ajouter / retirer de l'équipe",
                act_favourite: "Ajouter / retirer des favoris",
                act_party_card: "Équipe",
                act_sort: "Tri",
                act_language: "Langue",
                act_generation: "Génération de la table des types",
                act_help: "Cette aide",
                act_quit: "Quitter",
                act_load_back: "Charger et revenir",
                act_back: "Retour à la liste",
                act_by_type: "Filtrer par type",
                act_by_ability: "Filtrer par talent",
                act_by_egg: "Filtrer par groupe d'œufs",
                act_by_generation: "Filtrer par génération",
                act_by_favourite: "Favoris seulement",
                act_by_stat: "Filtrer par stat",
                act_chain_move: "Entre les stades",
                act_chain_jump: "Aller au stade",
                act_form_jump: "Ouvrir la forme",
                act_chain_expand: "Chaîne en plein écran",
                act_compare: "Épingler / comparer deux espèces",
                act_copy_team: "Copier pour Showdown",
                act_close: "Fermer",
                close_hint: "? / Esc pour fermer",
            },
            evo: EvoStrings {
                level: "Niv. {}",
                level_up: "Montée de niveau",
                trade: "Échange",
                trade_with: "Échange contre {}",
                use_item: "Utiliser {}",
                held_item: "Tient {}",
                knows_move: "Connaît {}",
                knows_move_type: "Connaît une capacité {}",
                happiness: "Bonheur {}",
                affection: "Affection {}",
                beauty: "Beauté {}",
                day: "Le jour",
                night: "La nuit",
                dusk: "Au crépuscule",
                location: "À {}",
                male: "Mâle",
                female: "Femelle",
                rain: "Sous la pluie",
                upside_down: "Console retournée",
                party_species: "Avec {} dans l'équipe",
                party_type: "Avec un type {} dans l'équipe",
                shed: "Place libre dans l'équipe",
            },
            legendary_label: "Légendaire",
            mythical_label: "Fabuleux",
            baby_label: "Bébé",
            shiny_label: "Chromatique",
        }
    }

    fn spanish() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex y Analizador de Evolución ",
            sidebar_title: " Pokemon ",
            search_title: " Buscar ",
            details_title: " Detalles ",
            evolution_title: " Cadena Evolutiva ",
            loading: "Cargando",
            loading_list: "Cargando Pokedex",
            no_selection: "Elige un Pokemon y pulsa Enter",
            no_results: "No se encontraron Pokemon",
            no_evolution: "Sin datos de evolución",
            types_label: "Tipos",
            height_label: "Altura",
            weight_label: "Peso",
            total_label: "Total",
            egg_groups_label: "Grupos huevo",
            genderless: "Sin género",
            catch_rate_label: "Ratio de captura",
            catch_hard: "difícil",
            catch_average: "media",
            catch_easy: "fácil",
            growth_label: "Crecimiento",
            happiness_label: "Amistad",
            habitat_label: "Hábitat",
            error_prefix: "Error",
            stat_hp: "PS",
            stat_attack: "Ataque",
            stat_defense: "Defensa",
            stat_sp_attack: "At. Esp",
            stat_sp_defense: "Def. Esp",
            stat_speed: "Velocid.",
            help: " ↑/↓ Navegar · Enter Elegir · / Buscar · ? Ayuda · Q Salir ",
            search_hint: "nombre · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "Total",
            sort_speed: "Velocid.",
            team_title: " Equipo ",
            team_empty: "Espacio en la lista para añadir un Pokemon",
            team_shared_weak: "Debilidades compartidas",
            team_unresisted: "Nadie lo resiste",
            team_offense_gaps: "Nadie lo golpea fuerte",
            team_all_clear: "nada — todo cubierto",
            abilities_label: "Habilidades",
            abilities_title: " Habilidades ",
            ability_hidden: "oculta",
            ability_close_hint: "Esc / A para cerrar",
            moves_title: " Movimientos ",
            moves_empty: "Sin movimientos registrados",
            moves_close_hint: "↑ ↓ para navegar · M / Esc cierra",
            calc_title: " Calculadora de stats ",
            calc_level: "Nivel",
            calc_nature: "Naturaleza",
            calc_base: "Base",
            calc_stat: "Valor",
            calc_hint: "↑ ↓ ← → Mover · 0-9 + - Editar · R Reiniciar · Esc Cerrar",
            forms_label: "Formas",
            forms_title: " Formas ",
            forms_close_hint: "↑ ↓ Elegir · Enter Abrir · Esc / V Cerrar",
            col_learn: "Niv",
            col_move: "Movimiento",
            col_type: "Tipo",
            col_category: "Cat.",
            col_power: "Pot",
            col_accuracy: "Prec",
            col_pp: "PP",
            learn_machine: "MT",
            learn_egg: "Huevo",
            learn_tutor: "Tutor",
            class_physical: "Fís",
            class_special: "Esp",
            class_status: "Estado",
            immune_by_ability: "Inmune por habilidad",
            generation_tag: "Gen.",
            absent_from_generation: "No está en estos juegos",
            immunity_maybe: "posible",
            team_close_hint: "↑ ↓ Elegir · C Comparar · E Copiar · Esc Cerrar",
            team_copied: "Copiado como equipo de Showdown",
            loading_filter: "Cargando la lista del filtro",
            expand_hint: "Pulsa E para ver las evoluciones",
            evo_nav_hint: "←/→ Elegir · Enter Ir · F Pantalla completa · Esc Volver",
            evo_card_hint: "←/→ Elegir · Enter Ir · F / Esc Cerrar",
            sprite_loading: "cargando…",
            language_title: " Idioma ",
            matchups_title: " Eficacia de Tipos ",
            matchups_defense: "Daño recibido",
            matchups_offense: "Muy eficaz contra",
            matchups_none: "nada",
            close_hint: "g G Gen. · Esc / T para cerrar",
            compare_title: " Cara a Cara ",
            compare_best_hit: "Mejor golpe del mismo tipo",
            compare_tie: "empate",
            compare_hint: "g G Gen. · Esc / C para cerrar",
            help_card: HelpStrings {
                title: " Ayuda ",
                ctx_list: "Lista",
                ctx_search: "Búsqueda",
                ctx_evolution: "Panel de evolución",
                ctx_party: "Tarjeta de equipo",
                ctx_forms: "Tarjeta de formas",
                ctx_cards: "Cualquier ficha",
                act_move: "Mover selección",
                act_jump10: "Saltar diez",
                act_load: "Cargar",
                act_search: "Buscar",
                act_evolutions: "Evoluciones",
                act_types: "Efectividad de tipos",
                act_abilities: "Habilidades",
                act_moves: "Movimientos",
                act_stat_calc: "Calculadora de stats",
                act_forms: "Otras formas",
                act_shiny: "Ilustración variocolor",
                act_random: "Al azar de la lista",
                act_party_toggle: "Añadir / quitar del equipo",
                act_favourite: "Marcar / quitar favorito",
                act_party_card: "Equipo",
                act_sort: "Orden",
                act_language: "Idioma",
                act_generation: "Generación de la tabla de tipos",
                act_help: "Esta ayuda",
                act_quit: "Salir",
                act_load_back: "Cargar y volver",
                act_back: "Volver a la lista",
                act_by_type: "Filtrar por tipo",
                act_by_ability: "Filtrar por habilidad",
                act_by_egg: "Filtrar por grupo huevo",
                act_by_generation: "Filtrar por generación",
                act_by_favourite: "Solo favoritos",
                act_by_stat: "Por estadística base",
                act_chain_move: "Entre etapas",
                act_chain_jump: "Ir a la etapa",
                act_form_jump: "Abrir forma",
                act_chain_expand: "Cadena a pantalla completa",
                act_compare: "Fijar / comparar dos especies",
                act_copy_team: "Copiar para Showdown",
                act_close: "Cerrar",
                close_hint: "? / Esc para cerrar",
            },
            evo: EvoStrings {
                level: "Niv. {}",
                level_up: "Subir de nivel",
                trade: "Intercambio",
                trade_with: "Intercambiar por {}",
                use_item: "Usar {}",
                held_item: "Llevando {}",
                knows_move: "Conoce {}",
                knows_move_type: "Conoce un movimiento {}",
                happiness: "Felicidad {}",
                affection: "Afecto {}",
                beauty: "Belleza {}",
                day: "De día",
                night: "De noche",
                dusk: "Al anochecer",
                location: "En {}",
                male: "Macho",
                female: "Hembra",
                rain: "Bajo la lluvia",
                upside_down: "Consola boca abajo",
                party_species: "Con {} en el equipo",
                party_type: "Con un tipo {} en el equipo",
                shed: "Hueco libre en el equipo",
            },
            legendary_label: "Legendario",
            mythical_label: "Singular",
            baby_label: "Bebé",
            shiny_label: "Variocolor",
        }
    }

    fn italian() -> Self {
        Strings {
            app_title: " Pokeductor — Pokedex e Analizzatore di Evoluzione ",
            sidebar_title: " Pokemon ",
            search_title: " Cerca ",
            details_title: " Dettagli ",
            evolution_title: " Catena Evolutiva ",
            loading: "Caricamento",
            loading_list: "Caricamento Pokedex",
            no_selection: "Scegli un Pokemon e premi Invio",
            no_results: "Nessun Pokemon trovato",
            no_evolution: "Nessun dato di evoluzione",
            types_label: "Tipi",
            height_label: "Altezza",
            weight_label: "Peso",
            total_label: "Totale",
            egg_groups_label: "Gruppi uova",
            genderless: "Senza sesso",
            catch_rate_label: "Tasso di cattura",
            catch_hard: "difficile",
            catch_average: "medio",
            catch_easy: "facile",
            growth_label: "Crescita",
            happiness_label: "Felicità",
            habitat_label: "Habitat",
            error_prefix: "Errore",
            stat_hp: "PS",
            stat_attack: "Attacco",
            stat_defense: "Difesa",
            stat_sp_attack: "Att. Sp",
            stat_sp_defense: "Dif. Sp",
            stat_speed: "Velocità",
            help: " ↑/↓ Naviga · Invio Scegli · / Cerca · ? Aiuto · Q Esci ",
            search_hint: "nome · dex:25 · type:water · gen:1",
            sort_dex: "Dex",
            sort_name: "A–Z",
            sort_total: "Totale",
            sort_speed: "Velocità",
            team_title: " Squadra ",
            team_empty: "Spazio nella lista per aggiungere un Pokemon",
            team_shared_weak: "Debolezze condivise",
            team_unresisted: "Nessuno lo resiste",
            team_offense_gaps: "Nessuno lo colpisce forte",
            team_all_clear: "niente — tutto coperto",
            abilities_label: "Abilità",
            abilities_title: " Abilità ",
            ability_hidden: "nascosta",
            ability_close_hint: "Esc / A per chiudere",
            moves_title: " Mosse ",
            moves_empty: "Nessuna mossa registrata",
            moves_close_hint: "↑ ↓ per scorrere · M / Esc chiude",
            calc_title: " Calcolo statistiche ",
            calc_level: "Livello",
            calc_nature: "Natura",
            calc_base: "Base",
            calc_stat: "Valore",
            calc_hint: "↑ ↓ ← → Muovi · 0-9 + - Modifica · R Azzera · Esc Chiudi",
            forms_label: "Forme",
            forms_title: " Forme ",
            forms_close_hint: "↑ ↓ Scegli · Invio Apri · Esc / V Chiudi",
            col_learn: "Liv",
            col_move: "Mossa",
            col_type: "Tipo",
            col_category: "Cat.",
            col_power: "Pot",
            col_accuracy: "Prec",
            col_pp: "PP",
            learn_machine: "MT",
            learn_egg: "Uovo",
            learn_tutor: "Tutor",
            class_physical: "Fis",
            class_special: "Spec",
            class_status: "Stato",
            immune_by_ability: "Immune per abilità",
            generation_tag: "Gen.",
            absent_from_generation: "Assente in questi giochi",
            immunity_maybe: "possibile",
            team_close_hint: "↑ ↓ Scegli · C Confronta · E Copia · Esc Chiudi",
            team_copied: "Copiata come squadra Showdown",
            loading_filter: "Caricamento del filtro",
            expand_hint: "Premi E per le evoluzioni",
            evo_nav_hint: "←/→ Scegli · Invio Vai · F Schermo intero · Esc Indietro",
            evo_card_hint: "←/→ Scegli · Invio Vai · F / Esc Chiudi",
            sprite_loading: "caricamento…",
            language_title: " Lingua ",
            matchups_title: " Efficacia dei Tipi ",
            matchups_defense: "Danni subiti",
            matchups_offense: "Superefficace contro",
            matchups_none: "niente",
            close_hint: "g G Gen. · Esc / T per chiudere",
            compare_title: " Testa a Testa ",
            compare_best_hit: "Miglior colpo dello stesso tipo",
            compare_tie: "pari",
            compare_hint: "g G Gen. · Esc / C per chiudere",
            help_card: HelpStrings {
                title: " Aiuto ",
                ctx_list: "Lista",
                ctx_search: "Ricerca",
                ctx_evolution: "Pannello evoluzioni",
                ctx_party: "Scheda squadra",
                ctx_forms: "Scheda forme",
                ctx_cards: "Ogni scheda",
                act_move: "Sposta selezione",
                act_jump10: "Salta dieci",
                act_load: "Carica",
                act_search: "Cerca",
                act_evolutions: "Evoluzioni",
                act_types: "Efficacia dei tipi",
                act_abilities: "Abilità",
                act_moves: "Mosse",
                act_stat_calc: "Calcolo statistiche",
                act_forms: "Altre forme",
                act_shiny: "Illustrazione cromatica",
                act_random: "A caso dalla lista",
                act_party_toggle: "Metti / togli in squadra",
                act_favourite: "Metti / togli nei preferiti",
                act_party_card: "Squadra",
                act_sort: "Ordinamento",
                act_language: "Lingua",
                act_generation: "Generazione della tabella dei tipi",
                act_help: "Questo aiuto",
                act_quit: "Esci",
                act_load_back: "Carica e torna",
                act_back: "Torna alla lista",
                act_by_type: "Filtra per tipo",
                act_by_ability: "Filtra per abilità",
                act_by_egg: "Filtra per gruppo uova",
                act_by_generation: "Filtra per generazione",
                act_by_favourite: "Solo preferiti",
                act_by_stat: "Filtra per stat base",
                act_chain_move: "Tra gli stadi",
                act_chain_jump: "Vai allo stadio",
                act_form_jump: "Apri forma",
                act_chain_expand: "Catena a schermo intero",
                act_compare: "Fissa / confronta due specie",
                act_copy_team: "Copia per Showdown",
                act_close: "Chiudi",
                close_hint: "? / Esc per chiudere",
            },
            evo: EvoStrings {
                level: "Liv. {}",
                level_up: "Aumento di livello",
                trade: "Scambio",
                trade_with: "Scambio con {}",
                use_item: "Usa {}",
                held_item: "Tenendo {}",
                knows_move: "Conosce {}",
                knows_move_type: "Conosce una mossa {}",
                happiness: "Felicità {}",
                affection: "Affetto {}",
                beauty: "Bellezza {}",
                day: "Di giorno",
                night: "Di notte",
                dusk: "Al tramonto",
                location: "A {}",
                male: "Maschio",
                female: "Femmina",
                rain: "Sotto la pioggia",
                upside_down: "Console capovolta",
                party_species: "Con {} in squadra",
                party_type: "Con un tipo {} in squadra",
                shed: "Posto libero in squadra",
            },
            legendary_label: "Leggendario",
            mythical_label: "Misterioso",
            baby_label: "Cucciolo",
            shiny_label: "Cromatico",
        }
    }
}

#[cfg(test)]
mod tests {
    use std::collections::HashMap;

    use super::*;

    #[test]
    fn every_language_reads_back_out_of_its_code() {
        for language in Language::ALL {
            assert_eq!(Language::from_code(language.flavor_code()), Some(language));
        }
    }

    #[test]
    fn an_unknown_language_code_is_not_guessed_at() {
        assert_eq!(Language::from_code("xx"), None);
        assert_eq!(Language::from_code(""), None);
    }

    fn umbreon() -> EvolutionCondition {
        EvolutionCondition {
            trigger: Some(EvolutionTrigger::LevelUp),
            min_happiness: Some(160),
            time_of_day: Some("night".into()),
            ..Default::default()
        }
    }

    #[test]
    fn every_language_fills_its_placeholders() {
        // A condition touching every templated string, so a translation that
        // dropped its `{}` shows up here rather than in the UI.
        let kitchen_sink = EvolutionCondition {
            trigger: Some(EvolutionTrigger::Trade),
            min_level: Some(16),
            item: Some("water-stone".into()),
            held_item: Some("kings-rock".into()),
            known_move: Some("ancient-power".into()),
            known_move_type: Some("fairy".into()),
            min_happiness: Some(160),
            min_affection: Some(2),
            min_beauty: Some(170),
            location: Some("mount-coronet".into()),
            trade_species: Some("shelmet".into()),
            party_species: Some("remoraid".into()),
            party_type: Some("rock".into()),
            ..Default::default()
        };
        for language in Language::ALL {
            for part in language.strings().evo.parts(&kitchen_sink) {
                assert!(
                    !part.contains("{}"),
                    "{:?} left a placeholder unfilled: {part}",
                    language
                );
            }
        }
    }

    #[test]
    fn parts_are_ordered_headline_first() {
        let english = Language::English.strings().evo;
        assert_eq!(english.short(&umbreon()).as_deref(), Some("Happiness 160"));
        assert_eq!(english.summary(&umbreon()), "Happiness 160 · At night");
    }

    #[test]
    fn a_bare_trigger_still_reads_as_something() {
        let condition = EvolutionCondition {
            trigger: Some(EvolutionTrigger::Other("three-critical-hits".into())),
            ..Default::default()
        };
        let english = Language::English.strings().evo;
        assert_eq!(english.summary(&condition), "Three Critical Hits");
    }

    #[test]
    fn an_unknown_condition_yields_no_text() {
        let english = Language::English.strings().evo;
        assert!(english.short(&EvolutionCondition::default()).is_none());
    }

    #[test]
    fn item_names_are_humanised() {
        let english = Language::English.strings().evo;
        let condition = EvolutionCondition {
            trigger: Some(EvolutionTrigger::UseItem),
            item: Some("water-stone".into()),
            ..Default::default()
        };
        assert_eq!(english.summary(&condition), "Use Water Stone");
    }

    #[test]
    fn every_type_in_the_chart_has_a_name_in_every_language() {
        for slug in crate::typechart::TYPES {
            for language in Language::ALL {
                let name = language.type_name(slug);
                assert!(!name.is_empty(), "{slug} has no {language:?} name");
                assert_eq!(type_slug(&name), Some(slug), "{name} does not read back");
            }
        }
    }

    #[test]
    fn no_word_names_two_different_types_across_languages() {
        let mut seen: HashMap<String, &str> = HashMap::new();
        for (slug, names) in TYPE_NAMES {
            for name in names.iter().copied().chain([slug]) {
                if let Some(other) = seen.insert(fold(name), slug) {
                    assert_eq!(other, slug, "{name} names both {other} and {slug}");
                }
            }
        }
    }

    #[test]
    fn a_type_name_is_read_with_or_without_its_accents() {
        assert_eq!(type_slug("Électrik"), Some("electric"));
        assert_eq!(type_slug("electrik"), Some("electric"));
        assert_eq!(type_slug("KARANLIK"), Some("dark"));
        assert_eq!(type_slug("celik"), Some("steel"));
        assert_eq!(type_slug("ghost"), Some("ghost"));
        assert_eq!(type_slug("gho"), None);
    }

    #[test]
    fn a_type_the_table_does_not_know_is_title_cased() {
        assert_eq!(Language::German.type_name("stellar"), "Stellar");
        assert_eq!(Language::German.type_name("ghost"), "Geist");
    }
}