MCPcopy Create free account
hub / github.com/Schneegans/Fly-Pie / ExampleMenu

Class ExampleMenu

src/prefs/ExampleMenu.js:25–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23//////////////////////////////////////////////////////////////////////////////////////////
24
25export default class ExampleMenu {
26
27 // ---------------------------------------------------------------------- static methods
28
29 static get() {
30
31 // Translators: This is the name of the tutorial menu.
32 const menu = {name: _('Example Menu'), icon: 'flypie-symbolic-#555', children: []};
33 const items = this.getItems();
34
35 for (let i = 0; i < items[0].names.length; i++) {
36
37 const child = {name: items[0].names[i], icon: items[0].icons[i], children: []};
38 menu.children.push(child);
39
40 for (let i = 0; i < items[1].names.length; i++) {
41 const grandchild = {
42 name: child.name + items[1].names[i],
43 icon: items[1].icons[i],
44 children: []
45 };
46 child.children.push(grandchild);
47
48 for (let i = 0; i < items[2].names.length; i++) {
49 const grandgrandchild = {
50 name: grandchild.name + items[2].names[i],
51 icon: items[2].icons[i],
52 };
53 grandchild.children.push(grandgrandchild);
54 }
55 }
56 }
57
58 return menu;
59 }
60
61 // Is there a way to assign the same gettext comment to multiple strings...?
62 static getItems() {
63 // clang-format off
64 return [
65 {
66 names: [
67 // Translators: The tutorial menu allows selecting triplets such as "Smelly
68 // Chocolate Muffin". This is one of the first words. The three words are directly
69 // appended to each other; therefore the trailing space is important. You can also
70 // use hyphens if appropriate.
71 _('Cold '),
72 // Translators: The tutorial menu allows selecting triplets such as "Smelly
73 // Chocolate Muffin". This is one of the first words. The three words are directly
74 // appended to each other; therefore the trailing space is important. You can also
75 // use hyphens if appropriate.
76 _('Hot '),
77 // Translators: The tutorial menu allows selecting triplets such as "Smelly
78 // Chocolate Muffin". This is one of the first words. The three words are directly
79 // appended to each other; therefore the trailing space is important. You can also
80 // use hyphens if appropriate.
81 _('Wet '),
82 // Translators: The tutorial menu allows selecting triplets such as "Smelly

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected