fix(mail(js)): use different email separator keys depending on locale

Fixes #3513
Fixes #4042
Fixes #5308
Fixes #5309
This commit is contained in:
Francis Lachapelle
2022-04-27 15:38:51 -04:00
parent a5b85d72bc
commit c2eed7844a
4 changed files with 32 additions and 26 deletions
@@ -163,14 +163,36 @@
else
data.SOGoContactsCategories = _.compact(data.SOGoContactsCategories);
data.emailSeparatorKeys = [
9, // $mdConstant.KEY_CODE.TAB,
13, // $mdConstant.KEY_CODE.ENTER,
186, // $mdConstant.KEY_CODE.SEMICOLON
188 // $mdConstant.KEY_CODE.COMMA,
];
if (data.LocaleCode) {
data.ckLocaleCode = data.LocaleCode.replace('_', '-').toLowerCase();
// Exceptions
switch (data.LocaleCode) {
case 'it':
// The Italian keyboard layout has the same keycode (186) for '@' and ';'; we remove the semicolon.
data.emailSeparatorKeys = [
9, // $mdConstant.KEY_CODE.TAB,
13, // $mdConstant.KEY_CODE.ENTER,
188 // $mdConstant.KEY_CODE.COMMA,
];
break;
case 'ru':
// The Russian keyboard layout has the same keycode (186) for 'Ж' and ';'; we remove the semicolon.
// It also has the same keycode (188) for 'Б' and ','; we remove the comma.
data.emailSeparatorKeys = [
9, // $mdConstant.KEY_CODE.TAB,
13 // $mdConstant.KEY_CODE.ENTER,
];
break;
case 'sr_ME':
case 'sr_RS':
data.ckLocaleCode = 'sr-latn';
break;
default:
data.ckLocaleCode = data.LocaleCode.replace('_', '-').toLowerCase();
}
}