Skip to content

Commit 940986e

Browse files
authored
Add material localizations for keyboard keys used for shortcut descriptions in menus. (#99020)
This change adds some localizations for keyboard keys that will be used in creating shortcut descriptions in menus.
1 parent d1daa5d commit 940986e

82 files changed

Lines changed: 19270 additions & 536 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/flutter/lib/src/material/material_localizations.dart

Lines changed: 350 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,180 @@ abstract class MaterialLocalizations {
496496
/// The default semantics label for a [RefreshIndicator].
497497
String get refreshIndicatorSemanticLabel;
498498

499+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.alt].
500+
String get keyboardKeyAlt;
501+
502+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.altGraph].
503+
String get keyboardKeyAltGraph;
504+
505+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.backspace].
506+
String get keyboardKeyBackspace;
507+
508+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.capsLock].
509+
String get keyboardKeyCapsLock;
510+
511+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.channelDown].
512+
String get keyboardKeyChannelDown;
513+
514+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.channelUp].
515+
String get keyboardKeyChannelUp;
516+
517+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.control].
518+
String get keyboardKeyControl;
519+
520+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.delete].
521+
String get keyboardKeyDelete;
522+
523+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.eisu].
524+
String get keyboardKeyEisu;
525+
526+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.eject].
527+
String get keyboardKeyEject;
528+
529+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.end].
530+
String get keyboardKeyEnd;
531+
532+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.escape].
533+
String get keyboardKeyEscape;
534+
535+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.fn].
536+
String get keyboardKeyFn;
537+
538+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.hangulMode].
539+
String get keyboardKeyHangulMode;
540+
541+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.hanjaMode].
542+
String get keyboardKeyHanjaMode;
543+
544+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.hankaku].
545+
String get keyboardKeyHankaku;
546+
547+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.hiragana].
548+
String get keyboardKeyHiragana;
549+
550+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.hiraganaKatakana].
551+
String get keyboardKeyHiraganaKatakana;
552+
553+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.home].
554+
String get keyboardKeyHome;
555+
556+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.insert].
557+
String get keyboardKeyInsert;
558+
559+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.kanaMode].
560+
String get keyboardKeyKanaMode;
561+
562+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.kanjiMode].
563+
String get keyboardKeyKanjiMode;
564+
565+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.katakana].
566+
String get keyboardKeyKatakana;
567+
568+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.meta].
569+
String get keyboardKeyMeta;
570+
571+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.meta] on macOS.
572+
String get keyboardKeyMetaMacOs;
573+
574+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.meta] on Windows.
575+
String get keyboardKeyMetaWindows;
576+
577+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numLock].
578+
String get keyboardKeyNumLock;
579+
580+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad1].
581+
String get keyboardKeyNumpad1;
582+
583+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad2].
584+
String get keyboardKeyNumpad2;
585+
586+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad3].
587+
String get keyboardKeyNumpad3;
588+
589+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad4].
590+
String get keyboardKeyNumpad4;
591+
592+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad5].
593+
String get keyboardKeyNumpad5;
594+
595+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad6].
596+
String get keyboardKeyNumpad6;
597+
598+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad7].
599+
String get keyboardKeyNumpad7;
600+
601+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad8].
602+
String get keyboardKeyNumpad8;
603+
604+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad9].
605+
String get keyboardKeyNumpad9;
606+
607+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpad0].
608+
String get keyboardKeyNumpad0;
609+
610+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadAdd].
611+
String get keyboardKeyNumpadAdd;
612+
613+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadComma].
614+
String get keyboardKeyNumpadComma;
615+
616+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadDecimal].
617+
String get keyboardKeyNumpadDecimal;
618+
619+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadDivide].
620+
String get keyboardKeyNumpadDivide;
621+
622+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadEnter].
623+
String get keyboardKeyNumpadEnter;
624+
625+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadEqual].
626+
String get keyboardKeyNumpadEqual;
627+
628+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadMultiply].
629+
String get keyboardKeyNumpadMultiply;
630+
631+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadParenLeft].
632+
String get keyboardKeyNumpadParenLeft;
633+
634+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadParenRight].
635+
String get keyboardKeyNumpadParenRight;
636+
637+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.numpadSubtract].
638+
String get keyboardKeyNumpadSubtract;
639+
640+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.pageDown].
641+
String get keyboardKeyPageDown;
642+
643+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.pageUp].
644+
String get keyboardKeyPageUp;
645+
646+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.power].
647+
String get keyboardKeyPower;
648+
649+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.powerOff].
650+
String get keyboardKeyPowerOff;
651+
652+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.printScreen].
653+
String get keyboardKeyPrintScreen;
654+
655+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.romaji].
656+
String get keyboardKeyRomaji;
657+
658+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.scrollLock].
659+
String get keyboardKeyScrollLock;
660+
661+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.select].
662+
String get keyboardKeySelect;
663+
664+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.space].
665+
String get keyboardKeySpace;
666+
667+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.zenkaku].
668+
String get keyboardKeyZenkaku;
669+
670+
/// The shortcut label for the keyboard key [LogicalKeyboardKey.zenkakuHankaku].
671+
String get keyboardKeyZenkakuHankaku;
672+
499673
/// The `MaterialLocalizations` from the closest [Localizations] instance
500674
/// that encloses the given context.
501675
///
@@ -640,7 +814,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
640814
case TimeOfDayFormat.frenchCanadian:
641815
case TimeOfDayFormat.H_colon_mm:
642816
case TimeOfDayFormat.HH_dot_mm:
643-
throw AssertionError('$runtimeType does not support $format.');
817+
throw AssertionError('$runtimeType does not support $format.');
644818
}
645819
}
646820

@@ -929,7 +1103,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
9291103

9301104
@override
9311105
String licensesPackageDetailText(int licenseCount) {
932-
assert (licenseCount >= 0);
1106+
assert(licenseCount >= 0);
9331107
switch (licenseCount) {
9341108
case 0:
9351109
return 'No licenses.';
@@ -1085,4 +1259,178 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
10851259
return '$remaining characters remaining';
10861260
}
10871261
}
1262+
1263+
@override
1264+
String get keyboardKeyAlt => 'Alt';
1265+
1266+
@override
1267+
String get keyboardKeyAltGraph => 'AltGr';
1268+
1269+
@override
1270+
String get keyboardKeyBackspace => 'Backspace';
1271+
1272+
@override
1273+
String get keyboardKeyCapsLock => 'Caps Lock';
1274+
1275+
@override
1276+
String get keyboardKeyChannelDown => 'Channel Down';
1277+
1278+
@override
1279+
String get keyboardKeyChannelUp => 'Channel Up';
1280+
1281+
@override
1282+
String get keyboardKeyControl => 'Ctrl';
1283+
1284+
@override
1285+
String get keyboardKeyDelete => 'Del';
1286+
1287+
@override
1288+
String get keyboardKeyEisu => 'Eisū';
1289+
1290+
@override
1291+
String get keyboardKeyEject => 'Eject';
1292+
1293+
@override
1294+
String get keyboardKeyEnd => 'End';
1295+
1296+
@override
1297+
String get keyboardKeyEscape => 'Esc';
1298+
1299+
@override
1300+
String get keyboardKeyFn => 'Fn';
1301+
1302+
@override
1303+
String get keyboardKeyHangulMode => 'Hangul Mode';
1304+
1305+
@override
1306+
String get keyboardKeyHanjaMode => 'Hanja Mode';
1307+
1308+
@override
1309+
String get keyboardKeyHankaku => 'Hankaku';
1310+
1311+
@override
1312+
String get keyboardKeyHiragana => 'Hiragana';
1313+
1314+
@override
1315+
String get keyboardKeyHiraganaKatakana => 'Hiragana Katakana';
1316+
1317+
@override
1318+
String get keyboardKeyHome => 'Home';
1319+
1320+
@override
1321+
String get keyboardKeyInsert => 'Insert';
1322+
1323+
@override
1324+
String get keyboardKeyKanaMode => 'Kana Mode';
1325+
1326+
@override
1327+
String get keyboardKeyKanjiMode => 'Kanji Mode';
1328+
1329+
@override
1330+
String get keyboardKeyKatakana => 'Katakana';
1331+
1332+
@override
1333+
String get keyboardKeyMeta => 'Meta';
1334+
1335+
@override
1336+
String get keyboardKeyMetaMacOs => 'Command';
1337+
1338+
@override
1339+
String get keyboardKeyMetaWindows => 'Win';
1340+
1341+
@override
1342+
String get keyboardKeyNumLock => 'Num Lock';
1343+
1344+
@override
1345+
String get keyboardKeyNumpad1 => 'Num 1';
1346+
1347+
@override
1348+
String get keyboardKeyNumpad2 => 'Num 2';
1349+
1350+
@override
1351+
String get keyboardKeyNumpad3 => 'Num 3';
1352+
1353+
@override
1354+
String get keyboardKeyNumpad4 => 'Num 4';
1355+
1356+
@override
1357+
String get keyboardKeyNumpad5 => 'Num 5';
1358+
1359+
@override
1360+
String get keyboardKeyNumpad6 => 'Num 6';
1361+
1362+
@override
1363+
String get keyboardKeyNumpad7 => 'Num 7';
1364+
1365+
@override
1366+
String get keyboardKeyNumpad8 => 'Num 8';
1367+
1368+
@override
1369+
String get keyboardKeyNumpad9 => 'Num 9';
1370+
1371+
@override
1372+
String get keyboardKeyNumpad0 => 'Num 0';
1373+
1374+
@override
1375+
String get keyboardKeyNumpadAdd => 'Num +';
1376+
1377+
@override
1378+
String get keyboardKeyNumpadComma => 'Num ,';
1379+
1380+
@override
1381+
String get keyboardKeyNumpadDecimal => 'Num .';
1382+
1383+
@override
1384+
String get keyboardKeyNumpadDivide => 'Num /';
1385+
1386+
@override
1387+
String get keyboardKeyNumpadEnter => 'Num Enter';
1388+
1389+
@override
1390+
String get keyboardKeyNumpadEqual => 'Num =';
1391+
1392+
@override
1393+
String get keyboardKeyNumpadMultiply => 'Num *';
1394+
1395+
@override
1396+
String get keyboardKeyNumpadParenLeft => 'Num (';
1397+
1398+
@override
1399+
String get keyboardKeyNumpadParenRight => 'Num )';
1400+
1401+
@override
1402+
String get keyboardKeyNumpadSubtract => 'Num -';
1403+
1404+
@override
1405+
String get keyboardKeyPageDown => 'PgDown';
1406+
1407+
@override
1408+
String get keyboardKeyPageUp => 'PgUp';
1409+
1410+
@override
1411+
String get keyboardKeyPower => 'Power';
1412+
1413+
@override
1414+
String get keyboardKeyPowerOff => 'Power Off';
1415+
1416+
@override
1417+
String get keyboardKeyPrintScreen => 'Print Screen';
1418+
1419+
@override
1420+
String get keyboardKeyRomaji => 'Romaji';
1421+
1422+
@override
1423+
String get keyboardKeyScrollLock => 'Scroll Lock';
1424+
1425+
@override
1426+
String get keyboardKeySelect => 'Select';
1427+
1428+
@override
1429+
String get keyboardKeySpace => 'Space';
1430+
1431+
@override
1432+
String get keyboardKeyZenkaku => 'Zenkaku';
1433+
1434+
@override
1435+
String get keyboardKeyZenkakuHankaku => 'Zenkaku Hankaku';
10881436
}

packages/flutter/lib/src/widgets/shortcuts.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ class SingleActivator with Diagnosticable implements ShortcutActivator {
542542
/// Keys often produce different characters when combined with modifiers. For
543543
/// example, it might be helpful for the user to bring up a help menu by
544544
/// pressing the question mark ('?'). However, there is no logical key that
545-
/// directly represents a question mark. Althouh 'Shift+Slash' produces a '?'
545+
/// directly represents a question mark. Although 'Shift+Slash' produces a '?'
546546
/// character on a US keyboard, its logical key is still considered a Slash key,
547547
/// and hard-coding 'Shift+Slash' in this situation is unfriendly to other
548548
/// keyboard layouts.

0 commit comments

Comments
 (0)