OLD | NEW |
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
2 | 2 |
3 /** | 3 /** |
4 * @fileoverview This file defines the input tool, included IME and virtual | 4 * @fileoverview This file defines the input tool, included IME and virtual |
5 * keyboard. | 5 * keyboard. |
6 * | 6 * |
7 * @author wuyingbing@google.com (Yingbing Wu) | 7 * @author wuyingbing@google.com (Yingbing Wu) |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('i18n.input.lang.InputTool'); | 10 goog.provide('i18n.input.lang.InputTool'); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 */ | 108 */ |
109 InputTool.LanguageCodeThreeTwoMap = goog.object.create( | 109 InputTool.LanguageCodeThreeTwoMap = goog.object.create( |
110 'arm', 'hy', | 110 'arm', 'hy', |
111 'bel', 'be', | 111 'bel', 'be', |
112 'bul', 'bg', | 112 'bul', 'bg', |
113 'cat', 'ca', | 113 'cat', 'ca', |
114 'cze', 'cs', | 114 'cze', 'cs', |
115 'dan', 'da', | 115 'dan', 'da', |
116 'eng', 'en', | 116 'eng', 'en', |
117 'est', 'et', | 117 'est', 'et', |
| 118 'fao', 'fo', |
118 'fin', 'fi', | 119 'fin', 'fi', |
119 'fra', 'fr', | 120 'fra', 'fr', |
120 'geo', 'ka', | 121 'geo', 'ka', |
121 'ger', 'de', | 122 'ger', 'de', |
122 'gre', 'el', | 123 'gre', 'el', |
123 'heb', 'he', | 124 'heb', 'he', |
124 'hun', 'hu', | 125 'hun', 'hu', |
125 'ice', 'is', | 126 'ice', 'is', |
126 'ind', 'id', | 127 'ind', 'id', |
127 'ita', 'it', | 128 'ita', 'it', |
128 'jpn', 'ja', | 129 'jpn', 'ja', |
| 130 'kaz', 'kk', |
129 'lav', 'lv', | 131 'lav', 'lv', |
130 'lit', 'lt', | 132 'lit', 'lt', |
131 'mlt', 'mt', | 133 'mlt', 'mt', |
132 'mon', 'mn', | 134 'mon', 'mn', |
133 'msa', 'ms', | 135 'msa', 'ms', |
134 'nld', 'nl', | 136 'nld', 'nl', |
135 // The new specification is "nb", but NACL uses "no". | 137 // The new specification is "nb", but NACL uses "no". |
136 'nob', 'no', | 138 'nob', 'no', |
137 'pol', 'pl', | 139 'pol', 'pl', |
138 'por', 'pt', | 140 'por', 'pt', |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 InputTool.SpecialLayoutCodes_ = goog.object.create( | 298 InputTool.SpecialLayoutCodes_ = goog.object.create( |
297 InputToolCode.KEYBOARD_DUTCH_INTL, 'us_intl', | 299 InputToolCode.KEYBOARD_DUTCH_INTL, 'us_intl', |
298 InputToolCode.KEYBOARD_FRENCH_INTL, 'us_intl', | 300 InputToolCode.KEYBOARD_FRENCH_INTL, 'us_intl', |
299 InputToolCode.KEYBOARD_GERMAN_INTL, 'us_intl', | 301 InputToolCode.KEYBOARD_GERMAN_INTL, 'us_intl', |
300 InputToolCode.KEYBOARD_HAITIAN, 'fr', | 302 InputToolCode.KEYBOARD_HAITIAN, 'fr', |
301 InputToolCode.KEYBOARD_INDONESIAN, 'latn_002', | 303 InputToolCode.KEYBOARD_INDONESIAN, 'latn_002', |
302 InputToolCode.KEYBOARD_IRISH, 'latn_002', | 304 InputToolCode.KEYBOARD_IRISH, 'latn_002', |
303 InputToolCode.KEYBOARD_ITALIAN_INTL, 'us_intl', | 305 InputToolCode.KEYBOARD_ITALIAN_INTL, 'us_intl', |
304 InputToolCode.KEYBOARD_JAVANESE, 'latn_002', | 306 InputToolCode.KEYBOARD_JAVANESE, 'latn_002', |
305 InputToolCode.KEYBOARD_MARATHI, 'deva_phone', | 307 InputToolCode.KEYBOARD_MARATHI, 'deva_phone', |
| 308 InputToolCode.KEYBOARD_MARATHI_INSCRIPT, 'hi', |
306 InputToolCode.KEYBOARD_MALAY, 'latn_002', | 309 InputToolCode.KEYBOARD_MALAY, 'latn_002', |
307 InputToolCode.KEYBOARD_PORTUGUESE_BRAZIL_INTL, 'us_intl', | 310 InputToolCode.KEYBOARD_PORTUGUESE_BRAZIL_INTL, 'us_intl', |
308 InputToolCode.KEYBOARD_PORTUGUESE_PORTUGAL_INTL, 'us_intl', | 311 InputToolCode.KEYBOARD_PORTUGUESE_PORTUGAL_INTL, 'us_intl', |
| 312 InputToolCode.KEYBOARD_SANSKRIT_INSCRIPT, 'hi', |
309 InputToolCode.KEYBOARD_SPANISH_INTL, 'us_intl', | 313 InputToolCode.KEYBOARD_SPANISH_INTL, 'us_intl', |
310 InputToolCode.KEYBOARD_SWAHILI, 'latn_002', | 314 InputToolCode.KEYBOARD_SWAHILI, 'latn_002', |
311 InputToolCode.KEYBOARD_TAGALOG, 'latn_002', | 315 InputToolCode.KEYBOARD_TAGALOG, 'latn_002', |
312 InputToolCode.KEYBOARD_TIGRINYA, 'ethi', | 316 InputToolCode.KEYBOARD_TIGRINYA, 'ethi', |
313 InputToolCode.KEYBOARD_WELSH, 'latn_002'); | 317 InputToolCode.KEYBOARD_WELSH, 'latn_002'); |
314 | 318 |
315 | 319 |
316 /** | 320 /** |
317 * Parses previous old code to BCP 47 code. | 321 * Parses previous old code to BCP 47 code. |
318 * | 322 * |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 (inputToolType == 'und-latn-k0-und' || inputToolType == 'k0-und')) { | 431 (inputToolType == 'und-latn-k0-und' || inputToolType == 'k0-und')) { |
428 // If it's virtual keyboard having the inscript/phonetic rule. | 432 // If it's virtual keyboard having the inscript/phonetic rule. |
429 this.layoutCode = countryCode + | 433 this.layoutCode = countryCode + |
430 (inputToolType == 'k0-und' ? '_inscript' : '_phone'); | 434 (inputToolType == 'k0-und' ? '_inscript' : '_phone'); |
431 } else if (inputToolType == 'k0-und') { | 435 } else if (inputToolType == 'k0-und') { |
432 this.layoutCode = countryCode; | 436 this.layoutCode = countryCode; |
433 } else { | 437 } else { |
434 var matches = inputToolType.match(/k0-(.*)/); | 438 var matches = inputToolType.match(/k0-(.*)/); |
435 if (matches[1]) { | 439 if (matches[1]) { |
436 this.layoutCode = countryCode + '_' + matches[1].replace( | 440 this.layoutCode = countryCode + '_' + matches[1].replace( |
437 'qwerty', 'phone'); | 441 'qwerty', 'phone').replace('-', '_'); |
438 } | 442 } |
439 } | 443 } |
440 } | 444 } |
441 }; | 445 }; |
442 | 446 |
443 | 447 |
444 /** | 448 /** |
445 * Parses the input tool code. | 449 * Parses the input tool code. |
446 * TODO(wuyingbing): We will introduce new code pattern, and then write a new | 450 * TODO(wuyingbing): We will introduce new code pattern, and then write a new |
447 * parsing method. | 451 * parsing method. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 * Returns whether the input tool is Latin suggestion or not. | 595 * Returns whether the input tool is Latin suggestion or not. |
592 * | 596 * |
593 * @return {boolean} . | 597 * @return {boolean} . |
594 */ | 598 */ |
595 InputTool.prototype.isLatin = function() { | 599 InputTool.prototype.isLatin = function() { |
596 return this.type == InputToolType.IME && | 600 return this.type == InputToolType.IME && |
597 /^(en|fr|de|it|es|nl|pt|tr|sv|da|fi|no)/.test(this.code); | 601 /^(en|fr|de|it|es|nl|pt|tr|sv|da|fi|no)/.test(this.code); |
598 }; | 602 }; |
599 }); // goog.scope | 603 }); // goog.scope |
600 | 604 |
OLD | NEW |