Skip to content

Commit

Permalink
Fixed & cleaned up Vietnamese layout. See #136
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Mar 29, 2013
1 parent 02a44ee commit 6be87e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion layouts.html
Expand Up @@ -112,7 +112,7 @@
"Thai (qwerty):thai-qwerty", "Thai (qwerty):thai-qwerty",
"Turkish (q):turkish-q", "Turkish (q):turkish-q",
"Turkish (f):turkish-f", "Turkish (f):turkish-f",
"Vietnamese (qwerty):vietamese-qwerty" "Vietnamese (qwerty):vietnamese-qwerty"
], ],


t, o = ''; t, o = '';
Expand Down
46 changes: 27 additions & 19 deletions layouts/vietnamese.js
@@ -1,34 +1,42 @@
/* Viet keyboard layouts /* Vietnamese keyboard layouts + Telex key combinations (see https://github.com/Mottie/Keyboard/pull/136)
* contains layout: 'viet-qwerty' * contains layout: 'vietnamese-qwerty'
* Vinh Can Code: tbvinh@gmail.com * Vinh Can Code: tbvinh@gmail.com
*
* To use: * To use:
* Point to this js file into your page header: <script src="layouts/viet.js" type="text/javascript"></script> * Point to this js file into your page header: <script src="layouts/vietnamese.js" type="text/javascript"></script>
* Initialize the keyboard using: $('input').keyboard({ layout: 'viet-qwerty' }); * Initialize the keyboard using: $('input').keyboard({ layout: 'vietnamese-qwerty' });
* *
* license for this file: WTFPL, unless the source layout site has a problem with me using them as a reference * license for this file: WTFPL, unless the source layout site has a problem with me using them as a reference
*/ */


/* based on http://ascii-table.com/keyboard.php/190 */ /* based on http://ascii-table.com/keyboard.php/461 */
$.keyboard.layouts['vietamese-qwerty'] = { $.keyboard.layouts['vietnamese-qwerty'] = {
'default' : [ 'default' : [
"` 1 2 3 4 5 6 7 8 9 0 - = {bksp}", "` 1 2 3 4 5 6 7 8 9 0 - = {bksp}",
"{tab} q w e r t y u i o p [ ]", "{tab} q w e r t y u i o p [ ] \\",
"a s d f g h j k l ; ' \\ {enter}", "a s d f g h j k l ; ' {enter}",
"{shift} z x c v b n m < > , . / {shift}", "{shift} z x c v b n m < > , . / {shift}",
"{accept} {alt} {space} {alt} {cancel}" "{accept} {alt} {space} {alt} {cancel}"
], ],
'shift' : [ 'shift' : [
'| ! " # $ % ^ & * ( ) _ + {bksp}', '~ ! @ # $ % ^ & * ( ) _ + {bksp}',
"{tab} Q W E R T Y U I O P @", "{tab} Q W E R T Y U I O P { } |",
"A S D F G H J K L { } {enter}", "A S D F G H J K L : ' {enter}",
"{shift} Z X C V B N M < > ; : ? {shift}", "{shift} Z X C V B N M < > ; : ? {shift}",
"{accept} {alt} {space} {alt} {cancel}" "{accept} {alt} {space} {alt} {cancel}"
], ],
'alt' : [ 'alt' : [
'| ! " # $ % ^ & * ( ) _ + {bksp}', '{empty} \u0103 \u00e2 \u00ea \u00f4 {empty} \u031b {empty} {empty} {empty} \u0111 \u002d \u20ab {bksp}',
"{tab} Q W E R T Y U I O P \u00c7 @", "{tab} {empty} {empty} {empty} {empty} {empty} \u00ff {empty} {empty} \u0153 {empty} \u01b0 \u01a1 {empty}",
"A S D F G H J K L { } {enter}", "{empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} { } \u0302 {enter}",
"{shift} > Z X C V B N M ; : ? {shift}", "{shift} {empty} {empty} \u00e7 {empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} {shift}",
"{accept} {alt} {space} {alt} {cancel}"
],
'alt-shift' : [
'{empty} \u0102 \u00c2 \u00ca \u00d4 {empty} {empty} {empty} {empty} {empty} \u0110 \u005f + {bksp}',
"{tab} {empty} {empty} {empty} {empty} {empty} \u0178 {empty} {empty} \u0152 {empty} \u01af \u01a0 {empty}",
"{empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} { } \u0308 {enter}",
"{shift} {empty} {empty} \u00c7 {empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} {empty} {shift}",
"{accept} {alt} {space} {alt} {cancel}" "{accept} {alt} {space} {alt} {cancel}"
] ]
}; };
Expand All @@ -37,7 +45,7 @@ $.keyboard.layouts['vietamese-qwerty'] = {
// please update this section to match this language and email me with corrections! // please update this section to match this language and email me with corrections!
// *********************** // ***********************
if (typeof(language) === 'undefined') { var language = {}; }; if (typeof(language) === 'undefined') { var language = {}; };
language.viet = { language.vietnamese = {
display : { display : {
'a' : '\u2714:Validate (Shift-Enter)', // check mark - same action as accept 'a' : '\u2714:Validate (Shift-Enter)', // check mark - same action as accept
'accept' : 'accept (Shift-Enter)', 'accept' : 'accept (Shift-Enter)',
Expand Down Expand Up @@ -65,7 +73,7 @@ language.viet = {


// This will replace all default language options with these language options. // This will replace all default language options with these language options.
// it is separated out here so the layout demo will work properly. // it is separated out here so the layout demo will work properly.
$.extend(true, $.keyboard.defaultOptions, language.viet); $.extend(true, $.keyboard.defaultOptions, language.vietnamese);




$.extend(true, $.keyboard.defaultOptions.combos, { $.extend(true, $.keyboard.defaultOptions.combos, {
Expand Down Expand Up @@ -105,4 +113,4 @@ $.extend(true, $.keyboard.defaultOptions.combos, {


}); });


$.keyboard.comboRegex = /([ueoaidy"\u01B0""\u01A1""\u0103""\u00E2""\u0055""\u01AF""\u01A0""\u0102""\u00C2""\u00E2""\u00F4""\u00EA""\u00C2""\u00D4""\u00CA"])([a-z,0-9])/gim; $.keyboard.comboRegex = /([ueoaidy\u01B0\u01A1\u0103\u00E2\u0055\u01AF\u01A0\u0102\u00C2\u00E2\u00F4\u00EA\u00C2\u00D4\u00CA])([a-z,0-9])/gim;

0 comments on commit 6be87e2

Please sign in to comment.