Merge lp:~tintou/switchboard-plug-keyboard/translate into lp:~elementary-pantheon/switchboard-plug-keyboard/trunk

Proposed by Corentin Noël
Status: Merged
Approved by: Cody Garver
Approved revision: 235
Merged at revision: 233
Proposed branch: lp:~tintou/switchboard-plug-keyboard/translate
Merge into: lp:~elementary-pantheon/switchboard-plug-keyboard/trunk
Diff against target: 764 lines (+285/-418)
5 files modified
data/options.txt (+0/-172)
data/shortcuts.xml (+0/-100)
src/Pages/Layout/display.vala (+2/-1)
src/Pages/Options/option_handler.vala (+282/-144)
src/Pages/Shortcuts/shortcut.vala (+1/-1)
To merge this branch: bzr merge lp:~tintou/switchboard-plug-keyboard/translate
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+237174@code.launchpad.net

Commit message

Translate the Option Panel

To post a comment you must log in.
235. By Corentin Noël

Forgot to append an item.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'data/options.txt'
2--- data/options.txt 2013-02-05 15:55:12 +0000
3+++ data/options.txt 1970-01-01 00:00:00 +0000
4@@ -1,172 +0,0 @@
5-#Key(s) to change layout:grp:true
6-Right Alt (while pressed):grp:switch
7-Left Alt (while pressed):grp:lswitch
8-Left Win (while pressed):grp:lwin_switch
9-Right Win (while pressed):grp:rwin_switch
10-Any Win key (while pressed):grp:win_switch
11-Caps Lock (while pressed), Alt+Caps Lock does the original capslock action:grp:caps_switch
12-Right Ctrl (while pressed):grp:rctrl_switch
13-Right Alt:grp:toggle
14-Left Alt:grp:lalt_toggle
15-Caps Lock:grp:caps_toggle
16-Shift+Caps Lock:grp:shift_caps_toggle
17-Caps Lock (to first layout), Shift+Caps Lock (to last layout):grp:shift_caps_switch
18-Left Win (to first layout), Right Win/Menu (to last layout):grp:win_menu_switch
19-Left Ctrl (to first layout), Right Ctrl (to last layout):grp:lctrl_rctrl_switch
20-Alt+Caps Lock:grp:alt_caps_toggle
21-Both Shift keys together:grp:shifts_toggle
22-Both Alt keys together:grp:alts_toggle
23-Both Ctrl keys together:grp:ctrls_toggle
24-Ctrl+Shift:grp:ctrl_shift_toggle
25-Left Ctrl+Left Shift:grp:lctrl_lshift_toggle
26-Right Ctrl+Right Shift:grp:rctrl_rshift_toggle
27-Alt+Ctrl:grp:ctrl_alt_toggle
28-Alt+Shift:grp:alt_shift_toggle
29-Left Alt+Left Shift:grp:lalt_lshift_toggle
30-Alt+Space:grp:alt_space_toggle
31-Menu:grp:menu_toggle
32-Left Win:grp:lwin_toggle
33-Right Win:grp:rwin_toggle
34-Left Shift:grp:lshift_toggle
35-Right Shift:grp:rshift_toggle
36-Left Ctrl:grp:lctrl_toggle
37-Right Ctrl:grp:rctrl_toggle
38-Scroll Lock:grp:sclk_toggle
39-LeftCtrl+LeftWin (to first layout), RightCtrl+Menu (to second layout):grp:lctrl_lwin_rctrl_menu
40-#Key to choose 3rd level:lv3:true
41-Right Ctrl:lv3:switch
42-Menu:lv3:menu_switch
43-Any Win key:lv3:win_switch
44-Left Win:lv3:lwin_switch
45-Right Win:lv3:rwin_switch
46-Any Alt key:lv3:alt_switch
47-Left Alt:lv3:lalt_switch
48-Right Alt:lv3:ralt_switch
49-Right Alt, Shift+Right Alt key is Multi_Key:lv3:ralt_switch_multikey
50-Right Alt key never chooses 3rd level:lv3:ralt_alt
51-Enter on keypad:lv3:enter_switch
52-Caps Lock:lv3:caps_switch
53-Backslash:lv3:bksl_switch
54-<Less/Greater>:lv3:lsgt_switch
55-Caps Lock chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser:lv3:caps_switch_latch
56-Backslash chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser:lv3:bksl_switch_latch
57-<Less/Greater> chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser:lv3:lsgt_switch_latch
58-#Ctrl key position:ctrl:true
59-Caps Lock as Ctrl:ctrl:nocaps
60-Left Ctrl as Meta:ctrl:lctrl_meta
61-Swap Ctrl and Caps Lock:ctrl:swapcaps
62-At left of 'A':ctrl:ac_ctrl
63-At bottom left:ctrl:aa_ctrl
64-Right Ctrl as Right Alt:ctrl:rctrl_ralt
65-Menu as Right Ctrl:ctrl:menu_rctrl
66-Right Alt as Right Ctrl:ctrl:ctrl_ralt
67-#Use keyboard LED to show alternative layout:grp_led:true
68-Num Lock:grp_led:num
69-Caps Lock:grp_led:caps
70-Scroll Lock:grp_led:scroll
71-#Numeric keypad layout selection:keypad:false
72-Legacy:keypad:legacy
73-Unicode additions (arrows and math operators):keypad:oss
74-Unicode additions (arrows and math operators). Math operators on default level:keypad:future
75-Legacy Wang 724:keypad:legacy_wang
76-Wang 724 keypad with Unicode additions (arrows and math operators):keypad:oss_wang
77-Wang 724 keypad with Unicode additions (arrows and math operators). Math operators on default level:keypad:future_wang
78-Hexadecimal:keypad:hex
79-ATM/phone-style:keypad:atm
80-#Numeric keypad delete key behaviour:kpdl:false
81-Legacy key with dot:kpdl:dot
82-Legacy key with comma:kpdl:comma
83-Four-level key with dot:kpdl:dotoss
84-Four-level key with dot, latin-9 restriction:kpdl:dotoss_latin9
85-Four-level key with comma:kpdl:commaoss
86-Four-level key with momayyez:kpdl:momayyezoss
87-Four-level key with abstract separators:kpdl:kposs
88-Semi-colon on third level:kpdl:semi
89-#Caps Lock key behavior:caps:false
90-Caps Lock uses internal capitalization. Shift "pauses" Caps Lock:caps:internal
91-Caps Lock uses internal capitalization. Shift doesn't affect Caps Lock:caps:internal_nocancel
92-Caps Lock acts as Shift with locking. Shift "pauses" Caps Lock:caps:shift
93-Caps Lock acts as Shift with locking. Shift doesn't affect Caps Lock:caps:shift_nocancel
94-Caps Lock toggles normal capitalization of alphabetic characters:caps:capslock
95-Make Caps Lock an additional Num Lock:caps:numlock
96-Swap ESC and Caps Lock:caps:swapescape
97-Make Caps Lock an additional ESC:caps:escape
98-Make Caps Lock an additional Backspace:caps:backspace
99-Make Caps Lock an additional Super:caps:super
100-Make Caps Lock an additional Hyper:caps:hyper
101-Caps Lock toggles Shift so all keys are affected:caps:shiftlock
102-Caps Lock is disabled:caps:none
103-Make Caps Lock an additional Control but keep the Caps_Lock keysym:caps:ctrl_modifier
104-#Alt/Win key behavior:altwin:false
105-Add the standard behavior to Menu key:altwin:menu
106-Alt and Meta are on Alt keys:altwin:meta_alt
107-Control is mapped to Win keys (and the usual Ctrl keys):altwin:ctrl_win
108-Control is mapped to Alt keys, Alt is mapped to Win keys:altwin:ctrl_alt_win
109-Meta is mapped to Win keys:altwin:meta_win
110-Meta is mapped to Left Win:altwin:left_meta_win
111-Hyper is mapped to Win-keys:altwin:hyper_win
112-Alt is mapped to Right Win, Super to Menu:altwin:alt_super_win
113-Left Alt is swapped with Left Win:altwin:swap_lalt_lwin
114-#Compose key position:Compose key:true
115-Right Alt:compose:ralt
116-Left Win:compose:lwin
117-Right Win:compose:rwin
118-Menu:compose:menu
119-Left Ctrl:compose:lctrl
120-Right Ctrl:compose:rctrl
121-Caps Lock:compose:caps
122-<Less/Greater>:compose:102
123-Pause:compose:paus
124-PrtSc:compose:prsc
125-Scroll Lock:compose:sclk
126-#Miscellaneous compatibility options:compat:true
127-Default numeric keypad keys:numpad:pc
128-Numeric keypad keys always enter digits (as in Mac OS):numpad:mac
129-Shift with numeric keypad keys works as in MS Windows:numpad:microsoft
130-Shift does not cancel Num Lock, chooses 3rd level instead:numpad:shift3
131-Special keys (Ctrl+Alt+<key>) handled in a server:srvrkeys:none
132-Apple Aluminium Keyboard: emulate PC keys (Print, Scroll Lock, Pause, Num Lock):apple:alupckeys
133-Shift cancels Caps Lock:shift:breaks_caps
134-Enable extra typographic characters:misc:typo
135-Both Shift-Keys together toggle Caps Lock:shift:both_capslock
136-Both Shift-Keys together activate Caps Lock, one Shift-Key deactivates:shift:both_capslock_cancel
137-Both Shift-Keys together toggle ShiftLock:shift:both_shiftlock
138-Toggle PointerKeys with Shift + NumLock.:keypad:pointerkeys
139-Allow breaking grabs with keyboard actions (warning: security risk):grab:break_actions
140-#Adding currency signs to certain keys:eurosign:true
141-Euro on E:eurosign:e
142-Euro on 2:eurosign:2
143-Euro on 4:eurosign:4
144-Euro on 5:eurosign:5
145-Rupee on 4:rupeesign:4
146-#Key to choose 5th level:lv5:true
147-<Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser:lv5:lsgt_switch_lock
148-Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser:lv5:ralt_switch_lock
149-Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser:lv5:lwin_switch_lock
150-Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser:lv5:rwin_switch_lock
151-#Using space key to input non-breakable space character:nbsp:false
152-Usual space at any level:nbsp:none
153-Non-breakable space character at second level:nbsp:level2
154-Non-breakable space character at third level:nbsp:level3
155-Non-breakable space character at third level, nothing at fourth level:nbsp:level3s
156-Non-breakable space character at third level, thin non-breakable space character at fourth level:nbsp:level3n
157-Non-breakable space character at fourth level:nbsp:level4
158-Non-breakable space character at fourth level, thin non-breakable space character at sixth level:nbsp:level4n
159-Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift):nbsp:level4nl
160-Zero-width non-joiner character at second level:nbsp:zwnj2
161-Zero-width non-joiner character at second level, zero-width joiner character at third level:nbsp:zwnj2zwj3
162-Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level:nbsp:zwnj2zwj3nb4
163-Zero-width non-joiner character at second level, non-breakable space character at third level:nbsp:zwnj2nb3
164-Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level:nbsp:zwnj2nb3s
165-Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level:nbsp:zwnj2nb3zwj4
166-Zero-width non-joiner character at second level, non-breakable space character at third level, thin non-breakable space at fourth level:nbsp:zwnj2nb3nnb4
167-Zero-width non-joiner character at third level, zero-width joiner at fourth level:nbsp:zwnj3zwj4
168-#Japanese keyboard options:japan:true
169-Kana Lock key is locking:japan:kana_lock
170-NICOLA-F style Backspace:japan:nicola_f_bs
171-Make Zenkaku Hankaku an additional ESC:japan:hztg_escape
172-#Adding Esperanto circumflexes (supersigno):esperanto:false
173-To the corresponding key in a Qwerty keyboard.:esperanto:qwerty
174-To the corresponding key in a Dvorak keyboard.:esperanto:dvorak
175-#Key sequence to kill the X server:terminate:true
176-Control + Alt + Backspace:terminate:ctrl_alt_bksp
177
178=== removed file 'data/shortcuts.xml'
179--- data/shortcuts.xml 2013-05-20 18:14:25 +0000
180+++ data/shortcuts.xml 1970-01-01 00:00:00 +0000
181@@ -1,100 +0,0 @@
182-<shortcuts>
183-
184- <schemas>
185- <schema name="org.gnome.desktop.wm.keybindings" abbr="WM"/>
186- <schema name="org.gnome.mutter.keybindings" abbr="MUTTER"/>
187- <schema name="org.pantheon.desktop.gala.keybindings" abbr="GALA"/>
188- <schema name="org.gnome.settings-daemon.plugins.media-keys" abbr="MEDIA"/>
189- </schemas>
190-
191- <section name="Windows">
192- <shortcut schema="WM" key="close" action="Close"/>
193- <shortcut schema="WM" key="lower" action="Lower"/>
194- <shortcut schema="WM" key="toggle-maximized" action="Toggle Maximized"/>
195- <shortcut schema="WM" key="minimize" action="Minimize"/>
196- <shortcut schema="WM" key="maximize" action="Maximize"/>
197- <shortcut schema="WM" key="unmaximize" action="Unmaximize"/>
198- <shortcut schema="MUTTER" key="toggle-tiled-left" action="Tile Left"/>
199- <shortcut schema="MUTTER" key="toggle-tiled-right" action="Tile Right"/>
200- <shortcut schema="WM" key="toggle-fullscreen" action="Toggle Fullscreen"/>
201- <shortcut schema="WM" key="toggle-shaded" action="Toggle Shaded"/>
202- <shortcut schema="WM" key="toggle-on-all-workspaces" action="Toggle on all Workspaces"/>
203- <shortcut schema="WM" key="toggle-above" action="Toggle always on Top"/>
204- <shortcut schema="WM" key="switch-windows" action="Switch Windows"/>
205- <shortcut schema="WM" key="switch-windows-backward" action="Switch Windows backwards"/>
206- <shortcut schema="GALA" key="expose-windows" action="Expose Windows"/>
207- <shortcut schema="GALA" key="expose-all-windows" action="Expose all Windows"/>
208- </section>
209-
210- <section name="Workspaces">
211- <shortcut schema="WM" key="show-desktop" action="Show Workspace Switcher"/>
212- <shortcut schema="GALA" key="switch-to-workspace-first" action="Switch to first"/>
213- <shortcut schema="GALA" key="switch-to-workspace-last" action="Switch to new"/>
214- <shortcut schema="WM" key="switch-to-workspace-1" action="Switch to workspace 1"/>
215- <shortcut schema="WM" key="switch-to-workspace-2" action="Switch to workspace 2"/>
216- <shortcut schema="WM" key="switch-to-workspace-3" action="Switch to workspace 3"/>
217- <shortcut schema="WM" key="switch-to-workspace-4" action="Switch to workspace 4"/>
218- <shortcut schema="WM" key="switch-to-workspace-5" action="Switch to workspace 5"/>
219- <shortcut schema="WM" key="switch-to-workspace-6" action="Switch to workspace 6"/>
220- <shortcut schema="WM" key="switch-to-workspace-7" action="Switch to workspace 7"/>
221- <shortcut schema="WM" key="switch-to-workspace-8" action="Switch to workspace 8"/>
222- <shortcut schema="WM" key="switch-to-workspace-9" action="Switch to workspace 9"/>
223- <shortcut schema="WM" key="switch-to-workspace-left" action="Switch to left"/>
224- <shortcut schema="WM" key="switch-to-workspace-right" action="Switch to right"/>
225- <shortcut schema="WM" key="move-to-workspace-1" action="Move to workspace 1"/>
226- <shortcut schema="WM" key="move-to-workspace-2" action="Move to workspace 2"/>
227- <shortcut schema="WM" key="move-to-workspace-3" action="Move to workspace 3"/>
228- <shortcut schema="WM" key="move-to-workspace-4" action="Move to workspace 4"/>
229- <shortcut schema="WM" key="move-to-workspace-5" action="Move to workspace 5"/>
230- <shortcut schema="WM" key="move-to-workspace-6" action="Move to workspace 6"/>
231- <shortcut schema="WM" key="move-to-workspace-7" action="Move to workspace 7"/>
232- <shortcut schema="WM" key="move-to-workspace-8" action="Move to workspace 8"/>
233- <shortcut schema="WM" key="move-to-workspace-9" action="Move to workspace 9"/>
234- <shortcut schema="WM" key="move-to-workspace-left" action="Move to left"/>
235- <shortcut schema="WM" key="move-to-workspace-right" action="Move to right"/>
236- </section>
237-
238- <section name="Screenshots">
239- <shortcut schema="MEDIA" key="screenshot" action="Take a Screenshot"/>
240- <shortcut schema="MEDIA" key="screenshot-clip" action="Save Screenshot to Clipboard"/>
241- <shortcut schema="MEDIA" key="window-screenshot" action="Take a Screenshot of a Window"/>
242- <shortcut schema="MEDIA" key="window-screenshot-clip" action="Save Window-Screenshot to Clipboard"/>
243- <shortcut schema="MEDIA" key="area-screenshot" action="Take a Screenshot of an Area"/>
244- <shortcut schema="MEDIA" key="area-screenshot-clip" action="Save Area-Screenshot to Clipboard"/>
245- </section>
246-
247- <section name="Applications">
248- <shortcut schema="MEDIA" key="calculator" action="Calculator"/>
249- <shortcut schema="MEDIA" key="email" action="Email"/>
250- <shortcut schema="MEDIA" key="help" action="Help"/>
251- <shortcut schema="MEDIA" key="home" action="Home Folder"/>
252- <shortcut schema="MEDIA" key="search" action="File Search"/>
253- <shortcut schema="MEDIA" key="terminal" action="Terminal"/>
254- <shortcut schema="MEDIA" key="www" action="Internet Browser"/>
255- </section>
256-
257- <section name="Media">
258- <shortcut schema="MEDIA" key="volume-up" action="Volume Up"/>
259- <shortcut schema="MEDIA" key="volume-down" action="Volume Down"/>
260- <shortcut schema="MEDIA" key="volume-mute" action="Mute"/>
261- <shortcut schema="MEDIA" key="media" action="Launch Media Player"/>
262- <shortcut schema="MEDIA" key="play" action="Play"/>
263- <shortcut schema="MEDIA" key="pause" action="Pause"/>
264- <shortcut schema="MEDIA" key="stop" action="Stop"/>
265- <shortcut schema="MEDIA" key="previous" action="Previous Track"/>
266- <shortcut schema="MEDIA" key="next" action="Next Track"/>
267- <shortcut schema="MEDIA" key="eject" action="Eject"/>
268- </section>
269-
270- <section name="Universal Access">
271- <shortcut schema="MEDIA" key="decrease-text-size" action="Decrease Text Size"/>
272- <shortcut schema="MEDIA" key="increase-text-size" action="Increase Text Size"/>
273- <shortcut schema="MEDIA" key="magnifier" action="Toggle Magnifier"/>
274- <shortcut schema="MEDIA" key="magnifier-zoom-in" action="Magnifier Zoom in"/>
275- <shortcut schema="MEDIA" key="magnifier-zoom-out" action="Magnifier Zoom out"/>
276- <shortcut schema="MEDIA" key="on-screen-keyboard" action="Toggle On Screen Keyboard"/>
277- <shortcut schema="MEDIA" key="screenreader" action="Toggle Screenreader"/>
278- <shortcut schema="MEDIA" key="toggle-contrast" action="Toggle High Contrast"/>
279- </section>
280-
281-</shortcuts>
282
283=== modified file 'src/Pages/Layout/display.vala'
284--- src/Pages/Layout/display.vala 2014-08-10 17:57:01 +0000
285+++ src/Pages/Layout/display.vala 2014-10-04 23:26:26 +0000
286@@ -27,7 +27,6 @@
287 tree.insert_column_with_attributes (-1, null, cell, "text", 0);
288 tree.headers_visible = false;
289 tree.expand = true;
290- rebuild_list ();
291
292 var scroll = new Gtk.ScrolledWindow(null, null);
293 scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
294@@ -113,6 +112,8 @@
295 return;
296 update_cursor ();
297 });
298+
299+ rebuild_list ();
300 update_cursor ();
301 }
302
303
304=== modified file 'src/Pages/Options/option_handler.vala'
305--- src/Pages/Options/option_handler.vala 2014-01-06 17:12:27 +0000
306+++ src/Pages/Options/option_handler.vala 2014-10-04 23:26:26 +0000
307@@ -1,161 +1,299 @@
308-namespace Pantheon.Keyboard.Options
309-{
310+namespace Pantheon.Keyboard.Options {
311+ public class Item : GLib.Object {
312+ public string label { public get; private set; }
313+ public string option { public get; private set; }
314+ public bool multiple_selection { public get; private set; }
315+ public HashTable<string, string> table { public get; private set; }
316+
317+ public Item (string label, string option, bool multiple_selection) {
318+ table = new HashTable<string, string> (str_hash, str_equal);
319+ this.label = label;
320+ this.option = option;
321+ this.multiple_selection = multiple_selection;
322+
323+ if (multiple_selection == false) {
324+ table.@set (_("None"), "");
325+ }
326+ }
327+
328+ public new void @set (string key, string value) {
329+ table.@set (key, value);
330+ }
331+ }
332+
333 // class that parses the layout file, provides lists of languages and
334 // options, and converts between layout names and their gsettings codes
335- class OptionHandler : GLib.Object
336- {
337- Group[] groups;
338-
339- private string[] names;
340- private string[] codes;
341- private bool[] multiple_selection;
342-
343- public int length {
344- get {return names.length;}
345- }
346-
347- public OptionHandler ()
348- {
349- foreach (var l in parse_groups ())
350- {
351- var parts = l.split(":", 3);
352-
353- if (parts[0] == null || parts[1] == null || parts[2] == null)
354- {
355- warning ("Line \"%s\" has wrong format. Will be ignored.", l);
356- continue;
357- }
358-
359- names += parts[0];
360- codes += parts[1];
361-
362- var multi = bool.parse(parts[2]);
363- multiple_selection += multi;
364-
365- groups += new Group (parse_options (l), multi);
366- }
367- }
368-
369+ class OptionHandler : GLib.Object {
370+ List<Item> items;
371+
372+ public uint length {
373+ get {return items.length ();}
374+ }
375+
376+ public OptionHandler () {
377+ generate_items ();
378+ }
379+
380 public string[] get_groups () {
381+ string[] names = null;
382+ foreach (var item in items) {
383+ names += item.label;
384+ }
385+
386 return names;
387 }
388-
389+
390 public string[] get_options (uint index) {
391- return groups[index].names;
392+ string[] options = null;
393+ var opts = items.nth_data (index).table.get_keys ();
394+ foreach (var option in opts) {
395+ options += option;
396+ }
397+
398+ return options;
399 }
400-
401+
402 public bool get_multiple_selection (uint index) {
403- return multiple_selection[index];
404- }
405-
406- public string? get_code (uint l, uint v) {
407- return codes[l] + "\t" + groups[l].codes[v];
408- }
409-
410- public string get_name (uint l, uint v) {
411- return groups[l].names[v];
412- }
413-
414- public bool from_code (string code, out uint l, out uint v)
415- {
416- var parts = code.split("\t", 2);
417-
418+ return items.nth_data (index).multiple_selection;
419+ }
420+
421+ public string? get_code (uint index, uint v) {
422+ var item = items.nth (index).data;
423+ return item.option + "\t" + item.table.get_values ().nth_data (v);
424+ }
425+
426+ public string get_name (uint index, uint v) {
427+ return items.nth_data (index).table.get_keys ().nth_data (v);
428+ }
429+
430+ public bool from_code (string code, out uint l, out uint v) {
431+ var parts = code.split ("\t", 2);
432 l = v = 0;
433-
434- if (parts[0] == null) return false;
435-
436- while (codes[l] != parts[0])
437- if (++l > length)
438- return false;
439-
440- if (parts[1] == null) return true;
441-
442- while (groups[l].codes[v] != parts[1])
443- if (v++ > groups[l].codes.length)
444- return false;
445-
446- return true;
447- }
448-
449- // private class that contains the options of one language
450- private class Group : GLib.Object
451- {
452- public string[] names;
453- public string[] codes;
454-
455- public Group (string[] options, bool multi)
456- {
457- if (!multi) {
458- names += _("None");
459- codes += "";
460- }
461-
462- foreach (var v in options) {
463- var parts = v.split(":", 2);
464- names += parts[0];
465- codes += parts[1];
466- }
467- }
468- }
469-
470- // private functions to parse the files
471- private string[]? parse_groups ()
472- {
473- string[] return_val = null;
474-
475- var file = File.new_for_path (Build.PKGDATADIR + "/options.txt");
476-
477- if (!file.query_exists ()) {
478- warning ("File '%s' doesn't exist.\n", file.get_path ());
479- return return_val;
480- }
481-
482- try {
483- var dis = new DataInputStream (file.read ());
484-
485- string line;
486-
487- while ((line = dis.read_line (null)) != null)
488- if( "#" in line )
489- return_val += line.replace ("#", "");
490-
491- } catch (Error e) {
492- error ("%s", e.message);
493- }
494-
495- return return_val;
496- }
497-
498- private string[]? parse_options (string language)
499- {
500- string[] return_val = null;
501-
502- var file = File.new_for_path (Build.PKGDATADIR + "/options.txt");
503-
504- if (!file.query_exists ()) {
505- warning ("File '%s' doesn't exist.\n", file.get_path ());
506- return null;
507- }
508-
509- try {
510- var dis = new DataInputStream (file.read ());
511-
512- string line;
513-
514- while ((line = dis.read_line (null)) != null) {
515- if (line == "#"+language) {
516- while ((line = dis.read_line (null)) != null) {
517- if( "#" in line ) break;
518- return_val += line;
519+ if (parts[0] == null || parts[1] == null)
520+ return false;
521+
522+ foreach (var item in items) {
523+ v = 0;
524+ if (item.option == parts[0]) {
525+ foreach (var val in item.table.get_values ()) {
526+ if (val == parts[1]) {
527+ return true;
528 }
529- break;
530+
531+ v++;
532 }
533 }
534- } catch (Error e) {
535- error ("%s", e.message);
536+ l++;
537 }
538
539- return return_val;
540+ return false;
541+ }
542+
543+ private void generate_items () {
544+ items = new List<Item> ();
545+ var item = new Item (_("Key(s) to change layout"), "grp", true);
546+ item.set (_("Right Alt (while pressed)"), "grp:switch");
547+ item.set (_("Left Alt (while pressed)"), "grp:lswitch");
548+ item.set (_("Left Win (while pressed)"), "grp:lwin_switch");
549+ item.set (_("Right Win (while pressed)"), "grp:rwin_switch");
550+ item.set (_("Any Win key (while pressed)"), "grp:win_switch");
551+ item.set (_("Caps Lock (while pressed), Alt+Caps Lock does the original capslock action"), "grp:caps_switch");
552+ item.set (_("Right Ctrl (while pressed)"), "grp:rctrl_switch");
553+ item.set (_("Right Alt"), "grp:toggle");
554+ item.set (_("Left Alt"), "grp:lalt_toggle");
555+ item.set (_("Caps Lock"), "grp:caps_toggle");
556+ item.set (_("Shift+Caps Lock"), "grp:shift_caps_toggle");
557+ item.set (_("Caps Lock (to first layout), Shift+Caps Lock (to last layout)"), "grp:shift_caps_switch");
558+ item.set (_("Left Win (to first layout), Right Win/Menu (to last layout)"), "grp:win_menu_switch");
559+ item.set (_("Left Ctrl (to first layout), Right Ctrl (to last layout)"), "grp:lctrl_rctrl_switch");
560+ item.set (_("Alt+Caps Lock"), "grp:alt_caps_toggle");
561+ item.set (_("Both Shift keys together"), "grp:shifts_toggle");
562+ item.set (_("Both Alt keys together"), "grp:alts_toggle");
563+ item.set (_("Both Ctrl keys together"), "grp:ctrls_toggle");
564+ item.set (_("Ctrl+Shift"), "grp:ctrl_shift_toggle");
565+ item.set (_("Left Ctrl+Left Shift"), "grp:lctrl_lshift_toggle");
566+ item.set (_("Right Ctrl+Right Shift"), "grp:rctrl_rshift_toggle");
567+ item.set (_("Alt+Ctrl"), "grp:ctrl_alt_toggle");
568+ item.set (_("Alt+Shift"), "grp:alt_shift_toggle");
569+ item.set (_("Left Alt+Left Shift"), "grp:lalt_lshift_toggle");
570+ item.set (_("Alt+Space"), "grp:alt_space_toggle");
571+ item.set (_("Menu"), "grp:menu_toggle");
572+ item.set (_("Left Win"), "grp:lwin_toggle");
573+ item.set (_("Right Win"), "grp:rwin_toggle");
574+ item.set (_("Left Shift"), "grp:lshift_toggle");
575+ item.set (_("Right Shift"), "grp:rshift_toggle");
576+ item.set (_("Left Ctrl"), "grp:lctrl_toggle");
577+ item.set (_("Right Ctrl"), "grp:rctrl_toggle");
578+ item.set (_("Scroll Lock"), "grp:sclk_toggle");
579+ item.set (_("Left Ctrl+Left Win (to first layout), Right Ctrl+Menu (to second layout)"), "grp:lctrl_lwin_rctrl_menu");
580+ items.append (item);
581+
582+ item = new Item (_("Key to choose 3rd level"), "lv3", true);
583+ item.set (_("Right Ctrl"), "lv3:switch");
584+ item.set (_("Menu"), "lv3:menu_switch");
585+ item.set (_("Any Win key"), "lv3:win_switch");
586+ item.set (_("Left Win"), "lv3:lwin_switch");
587+ item.set (_("Right Win"), "lv3:rwin_switch");
588+ item.set (_("Any Alt key"), "lv3:alt_switch");
589+ item.set (_("Left Alt"), "lv3:lalt_switch");
590+ item.set (_("Right Alt"), "lv3:ralt_switch");
591+ item.set (_("Right Alt, Shift+Right Alt key is Multi_Key"), "lv3:ralt_switch_multikey");
592+ item.set (_("Right Alt key never chooses 3rd level"), "lv3:ralt_alt");
593+ item.set (_("Enter on keypad"), "lv3:enter_switch");
594+ item.set (_("Caps Lock"), "lv3:caps_switch");
595+ item.set (_("Backslash"), "lv3:bksl_switch");
596+ item.set (_("<Less/Greater>"), "lv3:lsgt_switch");
597+ item.set (_("Caps Lock chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser"), "lv3:caps_switch_latch");
598+ item.set (_("Backslash chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser"), "lv3:bksl_switch_latch");
599+ item.set (_("<Less/Greater> chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser"), "lv3:lsgt_switch_latch");
600+ items.append (item);
601+
602+ item = new Item (_("Ctrl key position"), "ctrl", true);
603+ item.set (_("Caps Lock as Ctrl"), "ctrl:nocaps");
604+ item.set (_("Left Ctrl as Meta"), "ctrl:lctrl_meta");
605+ item.set (_("Swap Ctrl and Caps Lock"), "ctrl:swapcaps");
606+ item.set (_("At left of 'A'"), "ctrl:ac_ctrl");
607+ item.set (_("At bottom left"), "ctrl:aa_ctrl");
608+ item.set (_("Right Ctrl as Right Alt"), "ctrl:rctrl_ralt");
609+ item.set (_("Menu as Right Ctrl"), "ctrl:menu_rctrl");
610+ item.set (_("Right Alt as Right Ctrl"), "ctrl:ctrl_ralt");
611+ items.append (item);
612+
613+ item = new Item (_("Use keyboard LED to show alternative layout"), "grp_led", true);
614+ item.set (_("Num Lock"), "grp_led:num");
615+ item.set (_("Caps Lock"), "grp_led:caps");
616+ item.set (_("Scroll Lock"), "grp_led:scroll");
617+ items.append (item);
618+
619+ item = new Item (_("Numeric keypad layout selection"), "keypad", false);
620+ item.set (_("Legacy"), "keypad:legacy");
621+ item.set (_("Unicode additions (arrows and math operators)"), "keypad:oss");
622+ item.set (_("Unicode additions (arrows and math operators). Math operators on default level"), "keypad:future");
623+ item.set (_("Legacy Wang 724"), "keypad:legacy_wang");
624+ item.set (_("Wang 724 keypad with Unicode additions (arrows and math operators)"), "keypad:oss_wang");
625+ item.set (_("Wang 724 keypad with Unicode additions (arrows and math operators). Math operators on default level"), "keypad:future_wang");
626+ item.set (_("Hexadecimal"), "keypad:hex");
627+ item.set (_("ATM/phone-style"), "keypad:atm");
628+ items.append (item);
629+
630+ item = new Item (_("Numeric keypad delete key behaviour"), "kpdl", false);
631+ item.set (_("Legacy key with dot"), "kpdl:dot");
632+ item.set (_("Legacy key with comma"), "kpdl:comma");
633+ item.set (_("Four-level key with dot"), "kpdl:dotoss");
634+ item.set (_("Four-level key with dot, latin-9 restriction"), "kpdl:dotoss_latin9");
635+ item.set (_("Four-level key with comma"), "kpdl:commaoss");
636+ item.set (_("Four-level key with momayyez"), "kpdl:momayyezoss");
637+ item.set (_("Four-level key with abstract separators"), "kpdl:kposs");
638+ item.set (_("Semi-colon on third level"), "kpdl:semi");
639+ items.append (item);
640+
641+ item = new Item (_("Caps Lock key behavior"), "caps", false);
642+ item.set (_("Caps Lock uses internal capitalization. Shift \"pauses\" Caps Lock"), "caps:internal");
643+ item.set (_("Caps Lock uses internal capitalization. Shift doesn't affect Caps Lock"), "caps:internal_nocancel");
644+ item.set (_("Caps Lock acts as Shift with locking. Shift \"pauses\" Caps Lock"), "caps:shift");
645+ item.set (_("Caps Lock acts as Shift with locking. Shift doesn't affect Caps Lock"), "caps:shift_nocancel");
646+ item.set (_("Caps Lock toggles normal capitalization of alphabetic characters"), "caps:capslock");
647+ item.set (_("Make Caps Lock an additional Num Lock"), "caps:numlock");
648+ item.set (_("Swap ESC and Caps Lock"), "caps:swapescape");
649+ item.set (_("Make Caps Lock an additional ESC"), "caps:escape");
650+ item.set (_("Make Caps Lock an additional Backspace"), "caps:backspace");
651+ item.set (_("Make Caps Lock an additional Super"), "caps:super");
652+ item.set (_("Make Caps Lock an additional Hyper"), "caps:hyper");
653+ item.set (_("Caps Lock toggles Shift so all keys are affected"), "caps:shiftlock");
654+ item.set (_("Caps Lock is disabled"), "caps:none");
655+ item.set (_("Make Caps Lock an additional Control but keep the Caps_Lock keysym"), "caps:ctrl_modifier");
656+ items.append (item);
657+
658+ item = new Item (_("Alt/Win key behavior"), "altwin", false);
659+ item.set (_("Add the standard behavior to Menu key"), "compose:menu");
660+ item.set (_("Alt and Meta are on Alt keys"), "compose:meta_alt");
661+ item.set (_("Control is mapped to Win keys (and the usual Ctrl keys)"), "compose:ctrl_win");
662+ item.set (_("Control is mapped to Alt keys, Alt is mapped to Win keys"), "compose:ctrl_alt_win");
663+ item.set (_("Meta is mapped to Win keys"), "compose:meta_win");
664+ item.set (_("Meta is mapped to Left Win"), "compose:left_meta_win");
665+ item.set (_("Hyper is mapped to Win-keys"), "compose:hyper_win");
666+ item.set (_("Alt is mapped to Right Win, Super to Menu"), "compose:alt_super_win");
667+ item.set (_("Left Alt is swapped with Left Win"), "compose:swap_lalt_lwin");
668+ items.append (item);
669+
670+ item = new Item (_("Compose key position"), "Compose key", true);
671+ item.set (_("Right Alt"), "compose:ralt");
672+ item.set (_("Left Win"), "compose:lwin");
673+ item.set (_("Right Win"), "compose:rwin");
674+ item.set (_("Menu"), "compose:menu");
675+ item.set (_("Left Ctrl"), "compose:lctrl");
676+ item.set (_("Right Ctrl"), "compose:rctrl");
677+ item.set (_("Caps Lock"), "compose:caps");
678+ item.set (_("<Less/Greater>"), "compose:102");
679+ item.set (_("Pause"), "compose:paus");
680+ item.set (_("PrtSc"), "compose:prsc");
681+ item.set (_("Scroll Lock"), "compose:sclk");
682+ items.append (item);
683+
684+ item = new Item (_("Miscellaneous compatibility options"), "compat", true);
685+ item.set (_("Default numeric keypad keys"), "numpad:pc");
686+ item.set (_("Numeric keypad keys always enter digits (as in Mac OS)"), "numpad:mac");
687+ item.set (_("Shift with numeric keypad keys works as in MS Windows"), "numpad:microsoft");
688+ item.set (_("Shift does not cancel Num Lock, chooses 3rd level instead"), "numpad:shift3");
689+ item.set (_("Special keys (Ctrl+Alt+<key>) handled in a server"), "srvrkeys:none");
690+ item.set (_("Apple Aluminium Keyboard: emulate PC keys (Print, Scroll Lock, Pause, Num Lock)"), "apple:alupckeys");
691+ item.set (_("Shift cancels Caps Lock"), "shift:breaks_caps");
692+ item.set (_("Enable extra typographic characters"), "misc:typo");
693+ item.set (_("Both Shift-Keys together toggle Caps Lock"), "shift:both_capslock");
694+ item.set (_("Both Shift-Keys together activate Caps Lock, one Shift-Key deactivates"), "shift:both_capslock_cancel");
695+ item.set (_("Both Shift-Keys together toggle ShiftLock"), "shift:both_shiftlock");
696+ item.set (_("Toggle PointerKeys with Shift + NumLock"), "keypad:pointerkeys");
697+ item.set (_("Allow breaking grabs with keyboard actions (warning: security risk)"), "grab:break_actions");
698+ items.append (item);
699+
700+ item = new Item (_("Adding currency signs to certain keys"), "eurosign", true);
701+ item.set (_("Euro on E"), "eurosign:e");
702+ item.set (_("Euro on 2"), "eurosign:2");
703+ item.set (_("Euro on 4"), "eurosign:4");
704+ item.set (_("Euro on 5"), "eurosign:5");
705+ item.set (_("Rupee on 4"), "rupeesign:4");
706+ items.append (item);
707+
708+ item = new Item (_("Key to choose 5th level"), "lv5", true);
709+ item.set (_("<Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lalt_switch_lock");
710+ item.set (_("Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:ralt_switch_lock");
711+ item.set (_("Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:lwin_switch_lock");
712+ item.set (_("Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser"), "lv5:rwin_switch_lock");
713+ items.append (item);
714+
715+ item = new Item (_("Using space key to input non-breakable space character"), "nbsp", false);
716+ item.set (_("Usual space at any level"), "nbsp:none");
717+ item.set (_("Non-breakable space character at second level"), "nbsp:level2");
718+ item.set (_("Non-breakable space character at third level"), "nbsp:level3");
719+ item.set (_("Non-breakable space character at third level, nothing at fourth leve"), "nbsp:level3s");
720+ item.set (_("Non-breakable space character at third level, thin non-breakable space character at fourth level"), "nbsp:level3n");
721+ item.set (_("Non-breakable space character at fourth level"), "nbsp:level4");
722+ item.set (_("Non-breakable space character at fourth level, thin non-breakable space character at sixth level"), "nbsp:level4n");
723+ item.set (_("Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift)"), "nbsp:level4nl");
724+ item.set (_("Zero-width non-joiner character at second level"), "nbsp:zwnj2");
725+ item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level"), "nbsp:zwnj2zwj3");
726+ item.set (_("Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level"), "zwnj2zwj3nb4");
727+ item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level"), "nbsp:zwnj2nb3");
728+ item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level"), "nbsp:zwnj2nb3s");
729+ item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level"), "nbsp:zwnj2nb3zwj4");
730+ item.set (_("Zero-width non-joiner character at second level, non-breakable space character at third level, thin non-breakable space at fourth level"), "nbsp:zwnj2nb3nnb4");
731+ item.set (_("Zero-width non-joiner character at third level, zero-width joiner at fourth level"), "nbsp:zwnj3zwj4");
732+ items.append (item);
733+
734+ item = new Item (_("Japanese keyboard options"), "japan", true);
735+ item.set (_("Kana Lock key is locking"), "japan:kana_lock");
736+ item.set (_("NICOLA-F style Backspace"), "japan:nicola_f_bs");
737+ item.set (_("Make Zenkaku Hankaku an additional ESC"), "japan:hztg_escape");
738+ items.append (item);
739+
740+ item = new Item (_("Adding Esperanto circumflexes (supersigno)"), "esperanto", false);
741+ item.set (_("To the corresponding key in a Qwerty keyboard"), "esperanto:qwerty");
742+ item.set (_("To the corresponding key in a Dvorak keyboard"), "esperanto:dvorak");
743+ items.append (item);
744+
745+ item = new Item (_("Key sequence to kill the X server"), "terminate", true);
746+ item.set (_("Control + Alt + Backspace"), "terminate:ctrl_alt_bksp");
747+ items.append (item);
748 }
749 }
750 }
751\ No newline at end of file
752
753=== modified file 'src/Pages/Shortcuts/shortcut.vala'
754--- src/Pages/Shortcuts/shortcut.vala 2014-01-06 17:12:27 +0000
755+++ src/Pages/Shortcuts/shortcut.vala 2014-10-04 23:26:26 +0000
756@@ -47,7 +47,7 @@
757 if ((modifiers & Gdk.ModifierType.SUPER_MASK) > 0)
758 tmp += "⌘" + SEPARATOR;
759 if ((modifiers & Gdk.ModifierType.CONTROL_MASK) > 0)
760- tmp += "Ctrl" + SEPARATOR;
761+ tmp += _("Ctrl") + SEPARATOR;
762 if ((modifiers & Gdk.ModifierType.MOD1_MASK) > 0)
763 tmp += "⎇" + SEPARATOR;
764 if ((modifiers & Gdk.ModifierType.MOD2_MASK) > 0)

Subscribers

People subscribed via source and target branches

to all changes: