Upgrade i18n() to use Object.entries()

And replace quoted object keys to be without quotes
This commit is contained in:
djmaze
2021-03-24 21:26:40 +01:00
parent fe4dbc729c
commit 7eaaa0a793
24 changed files with 224 additions and 231 deletions

View File

@@ -11,96 +11,96 @@ const
sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB'],
exts = {
'eml': 'message/rfc822',
'mime': 'message/rfc822',
'rtx': 'text/richtext',
'vcard': 'text/vcard',
'vcf': 'text/vcard',
'htm': 'text/html',
'html': 'text/html',
'csv': 'text/csv',
'ics': 'text/calendar',
'ifb': 'text/calendar',
'xml': 'text/xml',
'json': app+'json',
'p10': app+'pkcs10',
'p7c': app+'pkcs7-mime',
'p7m': app+'pkcs7-mime',
'p7s': app+'pkcs7-signature',
'torrent': app+'x-bittorrent',
eml: 'message/rfc822',
mime: 'message/rfc822',
rtx: 'text/richtext',
vcard: 'text/vcard',
vcf: 'text/vcard',
htm: 'text/html',
html: 'text/html',
csv: 'text/csv',
ics: 'text/calendar',
ifb: 'text/calendar',
xml: 'text/xml',
json: app+'json',
p10: app+'pkcs10',
p7c: app+'pkcs7-mime',
p7m: app+'pkcs7-mime',
p7s: app+'pkcs7-signature',
torrent: app+'x-bittorrent',
// scripts
'js': app+'javascript',
'pl': 'text/perl',
'css': 'text/css',
'asp': 'text/asp',
'php': app+'x-httpd-php',
'phtml': app+'x-httpd-php',
js: app+'javascript',
pl: 'text/perl',
css: 'text/css',
asp: 'text/asp',
php: app+'x-httpd-php',
phtml: app+'x-httpd-php',
// images
'jpg': 'image/jpeg',
'ico': 'image/x-icon',
'tif': 'image/tiff',
'svg': 'image/svg+xml',
'svgz': 'image/svg+xml',
jpg: 'image/jpeg',
ico: 'image/x-icon',
tif: 'image/tiff',
svg: 'image/svg+xml',
svgz: 'image/svg+xml',
// archives
'zip': app+'zip',
zip: app+'zip',
'7z': app+'x-7z-compressed',
'rar': app+'x-rar-compressed',
'cab': app+'vnd.ms-cab-compressed',
'gz': app+'x-gzip',
'tgz': app+'x-gzip',
'bz': app+'x-bzip',
'bz2': app+'x-bzip2',
'deb': app+'x-debian-package',
rar: app+'x-rar-compressed',
cab: app+'vnd.ms-cab-compressed',
gz: app+'x-gzip',
tgz: app+'x-gzip',
bz: app+'x-bzip',
bz2: app+'x-bzip2',
deb: app+'x-debian-package',
// audio
'mp3': 'audio/mpeg',
'wav': 'audio/x-wav',
'mp4a': 'audio/mp4',
'weba': 'audio/webm',
'm3u': 'audio/x-mpegurl',
mp3: 'audio/mpeg',
wav: 'audio/x-wav',
mp4a: 'audio/mp4',
weba: 'audio/webm',
m3u: 'audio/x-mpegurl',
// video
'qt': 'video/quicktime',
'mov': 'video/quicktime',
'wmv': 'video/windows-media',
'avi': 'video/x-msvideo',
qt: 'video/quicktime',
mov: 'video/quicktime',
wmv: 'video/windows-media',
avi: 'video/x-msvideo',
'3gp': 'video/3gpp',
'3g2': 'video/3gpp2',
'mp4v': 'video/mp4',
'mpg4': 'video/mp4',
'ogv': 'video/ogg',
'm4v': 'video/x-m4v',
'asf': 'video/x-ms-asf',
'asx': 'video/x-ms-asf',
'wm': 'video/x-ms-wm',
'wmx': 'video/x-ms-wmx',
'wvx': 'video/x-ms-wvx',
'movie': 'video/x-sgi-movie',
mp4v: 'video/mp4',
mpg4: 'video/mp4',
ogv: 'video/ogg',
m4v: 'video/x-m4v',
asf: 'video/x-ms-asf',
asx: 'video/x-ms-asf',
wm: 'video/x-ms-wm',
wmx: 'video/x-ms-wmx',
wvx: 'video/x-ms-wvx',
movie: 'video/x-sgi-movie',
// adobe
'pdf': app+'pdf',
'psd': 'image/vnd.adobe.photoshop',
'ai': app+'postscript',
'eps': app+'postscript',
'ps': app+'postscript',
pdf: app+'pdf',
psd: 'image/vnd.adobe.photoshop',
ai: app+'postscript',
eps: app+'postscript',
ps: app+'postscript',
// ms office
'doc': app+'msword',
'rtf': app+'rtf',
'xls': app+'vnd.ms-excel',
'ppt': app+'vnd.ms-powerpoint',
'docx': msOffice+'wordprocessingml.document',
'xlsx': msOffice+'spreadsheetml.sheet',
'dotx': msOffice+'wordprocessingml.template',
'pptx': msOffice+'presentationml.presentation',
doc: app+'msword',
rtf: app+'rtf',
xls: app+'vnd.ms-excel',
ppt: app+'vnd.ms-powerpoint',
docx: msOffice+'wordprocessingml.document',
xlsx: msOffice+'spreadsheetml.sheet',
dotx: msOffice+'wordprocessingml.template',
pptx: msOffice+'presentationml.presentation',
// open office
'odt': openDoc+'text',
'ods': openDoc+'spreadsheet',
'odp': openDoc+'presentation'
odt: openDoc+'text',
ods: openDoc+'spreadsheet',
odp: openDoc+'presentation'
};
export const FileType = {

View File

@@ -14,19 +14,12 @@ export const trigger = ko.observable(false);
* @returns {string}
*/
export function i18n(key, valueList, defaulValue) {
let valueName = '',
result = I18N_DATA[key];
let result = I18N_DATA[key] || defaulValue || key;
if (undefined === result) {
result = undefined === defaulValue ? key : defaulValue;
}
if (null != valueList) {
for (valueName in valueList) {
if (Object.prototype.hasOwnProperty.call(valueList, valueName)) {
result = result.replace('%' + valueName + '%', valueList[valueName]);
}
}
if (valueList) {
Object.entries(valueList).forEach(([key, value]) => {
result = result.replace('%' + key + '%', value);
});
}
return result;

View File

@@ -272,22 +272,22 @@ export class MessageModel extends AbstractModel {
lineAsCss() {
let classes = [];
Object.entries({
'deleted': this.deleted(),
deleted: this.deleted(),
'deleted-mark': this.isDeleted(),
'selected': this.selected(),
'checked': this.checked(),
'flagged': this.isFlagged(),
'unseen': this.isUnseen(),
'answered': this.isAnswered(),
'forwarded': this.isForwarded(),
'focused': this.focused(),
'important': this.isImportant(),
'withAttachments': this.hasAttachments(),
'new': this.newForAnimation(),
'emptySubject': !this.subject(),
// 'hasChildrenMessage': 1 < this.threadsLen(),
'hasUnseenSubMessage': this.hasUnseenSubMessage(),
'hasFlaggedSubMessage': this.hasFlaggedSubMessage()
selected: this.selected(),
checked: this.checked(),
flagged: this.isFlagged(),
unseen: this.isUnseen(),
answered: this.isAnswered(),
forwarded: this.isForwarded(),
focused: this.focused(),
important: this.isImportant(),
withAttachments: this.hasAttachments(),
new: this.newForAnimation(),
emptySubject: !this.subject(),
// hasChildrenMessage: 1 < this.threadsLen(),
hasUnseenSubMessage: this.hasUnseenSubMessage(),
hasFlaggedSubMessage: this.hasFlaggedSubMessage()
}).forEach(([key, value]) => value && classes.push(key));
return classes.join(' ');
}

View File

@@ -162,7 +162,7 @@ export class AbstractFetchRemote
*/
jsVersion(fCallback, sVersion) {
this.defaultRequest(fCallback, 'Version', {
'Version': sVersion
Version: sVersion
});
}

View File

@@ -13,19 +13,19 @@ export class BrandingAdminSettings {
this.title.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.title.trigger, this), {
'Title': value.trim()
Title: value.trim()
})
);
this.loadingDesc.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this), {
'LoadingDescription': value.trim()
LoadingDescription: value.trim()
})
);
this.faviconUrl.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this), {
'FaviconUrl': value.trim()
FaviconUrl: value.trim()
})
);
}

View File

@@ -74,12 +74,12 @@ export class ContactsAdminSettings {
addSubscribablesTo(this, {
enableContacts: value =>
Remote.saveAdminConfig(null, {
'ContactsEnable': value ? 1 : 0
ContactsEnable: value ? 1 : 0
}),
contactsSync: value =>
Remote.saveAdminConfig(null, {
'ContactsSync': value ? 1 : 0
ContactsSync: value ? 1 : 0
}),
contactsType: value => {
@@ -87,23 +87,23 @@ export class ContactsAdminSettings {
this.testContactsError(false);
this.testContactsErrorMessage('');
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.contactsTypeTrigger, this), {
'ContactsPdoType': value.trim()
ContactsPdoType: value.trim()
})
},
pdoDsn: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this), {
'ContactsPdoDsn': value.trim()
ContactsPdoDsn: value.trim()
}),
pdoUser: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this), {
'ContactsPdoUser': value.trim()
ContactsPdoUser: value.trim()
}),
pdoPassword: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this), {
'ContactsPdoPassword': value.trim()
ContactsPdoPassword: value.trim()
})
})
@@ -121,10 +121,10 @@ export class ContactsAdminSettings {
this.testing(true);
Remote.testContacts(this.onTestContactsResponse, {
'ContactsPdoType': this.contactsType(),
'ContactsPdoDsn': this.pdoDsn(),
'ContactsPdoUser': this.pdoUser(),
'ContactsPdoPassword': this.pdoPassword()
ContactsPdoType: this.contactsType(),
ContactsPdoDsn: this.pdoDsn(),
ContactsPdoUser: this.pdoUser(),
ContactsPdoPassword: this.pdoPassword()
});
}

View File

@@ -93,12 +93,12 @@ export class GeneralAdminSettings {
addSubscribablesTo(this, {
mainAttachmentLimit: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this), {
'AttachmentLimit': pInt(value)
AttachmentLimit: pInt(value)
}),
language: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.languageTrigger, this), {
'Language': value.trim()
Language: value.trim()
}),
languageAdmin: value => {
@@ -106,14 +106,14 @@ export class GeneralAdminSettings {
translatorReload(true, value)
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
.then(() => Remote.saveAdminConfig(null, {
'LanguageAdmin': value.trim()
LanguageAdmin: value.trim()
}));
},
theme: value => {
changeTheme(value, this.themeTrigger);
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.themeTrigger, this), {
'Theme': value.trim()
Theme: value.trim()
});
},

View File

@@ -19,27 +19,27 @@ export class LoginAdminSettings {
addSubscribablesTo(this, {
determineUserLanguage: value =>
Remote.saveAdminConfig(null, {
'DetermineUserLanguage': value ? 1 : 0
DetermineUserLanguage: value ? 1 : 0
}),
determineUserDomain: value =>
Remote.saveAdminConfig(null, {
'DetermineUserDomain': value ? 1 : 0
DetermineUserDomain: value ? 1 : 0
}),
allowLanguagesOnLogin: value =>
Remote.saveAdminConfig(null, {
'AllowLanguagesOnLogin': value ? 1 : 0
AllowLanguagesOnLogin: value ? 1 : 0
}),
hideSubmitButton: value =>
Remote.saveAdminConfig(null, {
'hideSubmitButton': value ? 1 : 0
hideSubmitButton: value ? 1 : 0
}),
defaultDomain: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.defaultDomain.trigger, this), {
'LoginDefaultDomain': value.trim()
LoginDefaultDomain: value.trim()
})
});
}

View File

@@ -24,7 +24,7 @@ export class PluginsAdminSettings {
this.enabledPlugins.subscribe(value =>
Remote.saveAdminConfig(null, {
'EnabledPlugins': value ? 1 : 0
EnabledPlugins: value ? 1 : 0
})
);
}

View File

@@ -57,36 +57,36 @@ export class SecurityAdminSettings {
capaOpenPGP: value =>
Remote.saveAdminConfig(null, {
'CapaOpenPGP': value ? 1 : 0
CapaOpenPGP: value ? 1 : 0
}),
capaTwoFactorAuth: value => {
value || this.capaTwoFactorAuthForce(false);
Remote.saveAdminConfig(null, {
'CapaTwoFactorAuth': value ? 1 : 0
CapaTwoFactorAuth: value ? 1 : 0
});
},
capaTwoFactorAuthForce: value =>
Remote.saveAdminConfig(null, {
'CapaTwoFactorAuthForce': value ? 1 : 0
CapaTwoFactorAuthForce: value ? 1 : 0
}),
useLocalProxyForExternalImages: value =>
Remote.saveAdminConfig(null, {
'UseLocalProxyForExternalImages': value ? 1 : 0
UseLocalProxyForExternalImages: value ? 1 : 0
}),
verifySslCertificate: value => {
value => value || this.allowSelfSigned(true);
Remote.saveAdminConfig(null, {
'VerifySslCertificate': value ? 1 : 0
VerifySslCertificate: value ? 1 : 0
});
},
allowSelfSigned: value =>
Remote.saveAdminConfig(null, {
'AllowSelfSigned': value ? 1 : 0
AllowSelfSigned: value ? 1 : 0
})
});

View File

@@ -27,7 +27,7 @@ export class ContactsUserSettings {
this.contactsAutosave.subscribe(value =>
Remote.saveSettings(null, {
'ContactsAutosave': value ? 1 : 0
ContactsAutosave: value ? 1 : 0
})
);

View File

@@ -68,19 +68,19 @@ export class GeneralUserSettings {
this.editorDefaultTypes = ko.computed(() => {
translatorTrigger();
return [
{ 'id': EditorDefaultType.Html, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML') },
{ 'id': EditorDefaultType.Plain, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN') },
{ 'id': EditorDefaultType.HtmlForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED') },
{ 'id': EditorDefaultType.PlainForced, 'name': i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED') }
{ id: EditorDefaultType.Html, name: i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML') },
{ id: EditorDefaultType.Plain, name: i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN') },
{ id: EditorDefaultType.HtmlForced, name: i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED') },
{ id: EditorDefaultType.PlainForced, name: i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED') }
];
});
this.layoutTypes = ko.computed(() => {
translatorTrigger();
return [
{ 'id': Layout.NoPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT') },
{ 'id': Layout.SidePreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT') },
{ 'id': Layout.BottomPreview, 'name': i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT') }
{ id: Layout.NoPreview, name: i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT') },
{ id: Layout.SidePreview, name: i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT') },
{ id: Layout.BottomPreview, name: i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT') }
];
});
@@ -142,7 +142,7 @@ export class GeneralUserSettings {
}
testSystemNotification() {
NotificationUserStore.displayDesktopNotification('SnappyMail', 'Test notification', { });
NotificationUserStore.displayDesktopNotification('SnappyMail', 'Test notification');
}
selectLanguage() {

View File

@@ -25,14 +25,14 @@ export class SecurityUserSettings {
this.autoLogoutOptions = ko.computed(() => {
translatorTrigger();
return [
{ 'id': 0, 'name': i18nLogout('NEVER_OPTION_NAME') },
{ 'id': 5, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 5 }) },
{ 'id': 10, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 10 }) },
{ 'id': 30, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 30 }) },
{ 'id': 60, 'name': i18nLogout('MINUTES_OPTION_NAME', { 'MINUTES': 60 }) },
{ 'id': 60 * 2, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 2 }) },
{ 'id': 60 * 5, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 5 }) },
{ 'id': 60 * 10, 'name': i18nLogout('HOURS_OPTION_NAME', { 'HOURS': 10 }) }
{ id: 0, name: i18nLogout('NEVER_OPTION_NAME') },
{ id: 5, name: i18nLogout('MINUTES_OPTION_NAME', { MINUTES: 5 }) },
{ id: 10, name: i18nLogout('MINUTES_OPTION_NAME', { MINUTES: 10 }) },
{ id: 30, name: i18nLogout('MINUTES_OPTION_NAME', { MINUTES: 30 }) },
{ id: 60, name: i18nLogout('MINUTES_OPTION_NAME', { MINUTES: 60 }) },
{ id: 60 * 2, name: i18nLogout('HOURS_OPTION_NAME', { HOURS: 2 }) },
{ id: 60 * 5, name: i18nLogout('HOURS_OPTION_NAME', { HOURS: 5 }) },
{ id: 60 * 10, name: i18nLogout('HOURS_OPTION_NAME', { HOURS: 10 }) }
];
});

View File

@@ -35,7 +35,7 @@ export class ThemesUserSettings {
changeTheme(value, this.themeTrigger);
Remote.saveSettings(null, {
'Theme': value
Theme: value
});
});

View File

@@ -247,16 +247,16 @@ export const MessageUserStore = new class {
NotificationUserStore.displayDesktopNotification(
AccountUserStore.email(),
i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': len
COUNT: len
}),
{ 'Url': mailBox(newMessages[0].Folder, 1) }
{ Url: mailBox(newMessages[0].Folder, 1) }
);
} else {
newMessages.forEach(item => {
NotificationUserStore.displayDesktopNotification(
EmailCollectionModel.reviveFromJson(item.From).toString(),
item.Subject,
{ 'Folder': item.Folder, 'Uid': item.Uid }
{ Folder: item.Folder, Uid: item.Uid }
);
});
}

View File

@@ -49,7 +49,7 @@ function domControlEncryptedClickHelper(store, dom, armoredMessage, recipients)
this,
true,
i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
'USER': validPublicKey.user + ' (' + validPublicKey.id + ')'
USER: validPublicKey.user + ' (' + validPublicKey.id + ')'
}),
decryptedMessage.getText()
);
@@ -105,7 +105,7 @@ function domControlSignedClickHelper(store, dom, armoredMessage) {
this,
true,
i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
'USER': validKey.user + ' (' + validKey.id + ')'
USER: validKey.user + ' (' + validKey.id + ')'
}),
message.getText()
);

View File

@@ -226,7 +226,7 @@ class ComposePopupView extends AbstractViewPopup {
sendButtonSuccess: () => !this.sendError() && !this.sendSuccessButSaveError(),
savedTimeText: () =>
this.savedTime() ? i18n('COMPOSE/SAVED_TIME', { 'TIME': this.savedTime().format('LT') }) : '',
this.savedTime() ? i18n('COMPOSE/SAVED_TIME', { TIME: this.savedTime().format('LT') }) : '',
emptyToErrorTooltip: () => (this.emptyToError() ? i18n('COMPOSE/EMPTY_TO_ERROR_DESC') : ''),
@@ -254,9 +254,9 @@ class ComposePopupView extends AbstractViewPopup {
identitiesOptions: () =>
IdentityUserStore.map(item => ({
'item': item,
'optValue': item.id(),
'optText': item.formattedName()
item: item,
optValue: item.id(),
optText: item.formattedName()
})),
currentIdentityView: () => {
@@ -931,8 +931,8 @@ class ComposePopupView extends AbstractViewPopup {
case ComposeType.ReplyAll:
sFrom = message.fromToLine(false, true);
sReplyTitle = i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
'DATETIME': sDate,
'EMAIL': sFrom
DATETIME: sDate,
EMAIL: sFrom
});
sText = sText.replace(/<img[^>]+>/g, '').replace(/<a\s[^>]+><\/a>/g, '').trim();

View File

@@ -49,9 +49,9 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
return null;
}
return oKey.users.map(user => ({
'id': oKey.guid,
'name': '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
'key': oKey
id: oKey.guid,
name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
key: oKey
}));
});
@@ -64,9 +64,9 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
return null;
}
return oKey.users.map(user => ({
'id': oKey.guid,
'name': '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
'key': oKey
id: oKey.guid,
name: '(' + oKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() + ') ' + user,
key: oKey
}));
});
return opts.flat().filter(v => v);
@@ -114,7 +114,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
} else if (!this.signKey().key) {
this.notification(
i18nPGP('NO_PRIVATE_KEY_FOUND_FOR', {
'EMAIL': this.signKey().email
EMAIL: this.signKey().email
})
);
@@ -150,7 +150,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
} else if (oKey && oKey.email) {
this.notification(
i18nPGP('NO_PUBLIC_KEYS_FOUND_FOR', {
'EMAIL': oKey.email
EMAIL: oKey.email
})
);
@@ -196,7 +196,7 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
this.notification(
i18nPGP('PGP_ERROR', {
'ERROR': '' + e
ERROR: '' + e
})
);
}
@@ -211,13 +211,13 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
.catch((e) => {
this.notification(
i18nPGP('PGP_ERROR', {
'ERROR': '' + e
ERROR: '' + e
})
);
});
} catch (e) {
this.notification(
i18nPGP('PGP_ERROR', {'ERROR': '' + e})
i18nPGP('PGP_ERROR', {ERROR: '' + e})
);
}
}
@@ -237,11 +237,11 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
if (option) {
this.signKey({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
empty: !option.key,
selected: ko.observable(!!option.key),
users: option.key.users,
hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
key: option.key
});
}
}
@@ -252,12 +252,12 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
if (option) {
this.encryptKeys.push({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'removable': ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
empty: !option.key,
selected: ko.observable(!!option.key),
removable: ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id),
users: option.key.users,
hash: option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
key: option.key
});
}
}
@@ -343,9 +343,9 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
const keys = PgpUserStore.findAllPrivateKeysByEmailNotNative(emailLine);
if (keys && keys[0]) {
this.signKey({
'users': keys[0].users || [emailLine],
'hash': keys[0].id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': keys[0]
users: keys[0].users || [emailLine],
hash: keys[0].id.substr(KEY_NAME_SUBSTR).toUpperCase(),
key: keys[0]
});
}
}
@@ -360,14 +360,14 @@ class ComposeOpenPgpPopupView extends AbstractViewPopup {
const keys = PgpUserStore.findAllPublicKeysByEmailNotNative(recEmail);
return keys
? keys.map(publicKey => ({
'empty': !publicKey,
'selected': ko.observable(!!publicKey),
'removable': ko.observable(
empty: !publicKey,
selected: ko.observable(!!publicKey),
removable: ko.observable(
!this.sign() || !this.signKey() || this.signKey().key.id !== publicKey.id
),
'users': publicKey ? publicKey.users || [recEmail] : [recEmail],
'hash': publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '',
'key': publicKey
users: publicKey ? publicKey.users || [recEmail] : [recEmail],
hash: publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '',
key: publicKey
}))
: [];
}).flat().validUnique(encryptKey => encryptKey.hash)

View File

@@ -63,13 +63,13 @@ class DomainPopupView extends AbstractViewPopup {
let result = '';
if (this.edit()) {
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { 'NAME': name });
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { NAME: name });
if (aliasName) {
result += ' ← ' + aliasName;
}
} else {
result = name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { 'NAME': name })
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { NAME: name })
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN');
}
@@ -78,7 +78,7 @@ class DomainPopupView extends AbstractViewPopup {
domainDesc: () => {
const name = this.name();
return !this.edit() && name ? i18n('POPUPS_DOMAIN/NEW_DOMAIN_DESC', { 'NAME': '*@' + name }) : '';
return !this.edit() && name ? i18n('POPUPS_DOMAIN/NEW_DOMAIN_DESC', { NAME: '*@' + name }) : '';
},
domainIsComputed: () => {

View File

@@ -66,22 +66,22 @@ class FilterPopupView extends AbstractViewPopup {
let i18nFilter = key => i18n('POPUPS_FILTER/SELECT_' + key);
this.fieldOptions([
{ 'id': FilterConditionField.From, 'name': i18n('GLOBAL/FROM') },
{ 'id': FilterConditionField.Recipient, 'name': i18nFilter('FIELD_RECIPIENTS') },
{ 'id': FilterConditionField.Subject, 'name': i18n('GLOBAL/SUBJECT') },
{ 'id': FilterConditionField.Size, 'name': i18nFilter('FIELD_SIZE') },
{ 'id': FilterConditionField.Header, 'name': i18nFilter('FIELD_HEADER') }
{ id: FilterConditionField.From, name: i18n('GLOBAL/FROM') },
{ id: FilterConditionField.Recipient, name: i18nFilter('FIELD_RECIPIENTS') },
{ id: FilterConditionField.Subject, name: i18n('GLOBAL/SUBJECT') },
{ id: FilterConditionField.Size, name: i18nFilter('FIELD_SIZE') },
{ id: FilterConditionField.Header, name: i18nFilter('FIELD_HEADER') }
]);
this.typeOptions([
{ 'id': FilterConditionType.Contains, 'name': i18nFilter('TYPE_CONTAINS') },
{ 'id': FilterConditionType.NotContains, 'name': i18nFilter('TYPE_NOT_CONTAINS') },
{ 'id': FilterConditionType.EqualTo, 'name': i18nFilter('TYPE_EQUAL_TO') },
{ 'id': FilterConditionType.NotEqualTo, 'name': i18nFilter('TYPE_NOT_EQUAL_TO') }
{ id: FilterConditionType.Contains, name: i18nFilter('TYPE_CONTAINS') },
{ id: FilterConditionType.NotContains, name: i18nFilter('TYPE_NOT_CONTAINS') },
{ id: FilterConditionType.EqualTo, name: i18nFilter('TYPE_EQUAL_TO') },
{ id: FilterConditionType.NotEqualTo, name: i18nFilter('TYPE_NOT_EQUAL_TO') }
]);
// this.actionTypeOptions.push({'id': FilterAction.None,
// 'name': i18n('GLOBAL/NONE')});
// this.actionTypeOptions.push({id: FilterAction.None,
// name: i18n('GLOBAL/NONE')});
const modules = SieveUserStore.capa;
if (modules) {
if (modules.includes('imap4flags')) {
@@ -90,45 +90,45 @@ class FilterPopupView extends AbstractViewPopup {
if (modules.includes('fileinto')) {
this.actionTypeOptions.push({
'id': FilterAction.MoveTo,
'name': i18nFilter('ACTION_MOVE_TO')
id: FilterAction.MoveTo,
name: i18nFilter('ACTION_MOVE_TO')
});
this.actionTypeOptions.push({
'id': FilterAction.Forward,
'name': i18nFilter('ACTION_FORWARD_TO')
id: FilterAction.Forward,
name: i18nFilter('ACTION_FORWARD_TO')
});
}
if (modules.includes('reject')) {
this.actionTypeOptions.push({ 'id': FilterAction.Reject, 'name': i18nFilter('ACTION_REJECT') });
this.actionTypeOptions.push({ id: FilterAction.Reject, name: i18nFilter('ACTION_REJECT') });
}
if (modules.includes('vacation')) {
this.actionTypeOptions.push({
'id': FilterAction.Vacation,
'name': i18nFilter('ACTION_VACATION_MESSAGE')
id: FilterAction.Vacation,
name: i18nFilter('ACTION_VACATION_MESSAGE')
});
}
if (modules.includes('body')) {
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18nFilter('FIELD_BODY') });
this.fieldOptions.push({ id: FilterConditionField.Body, name: i18nFilter('FIELD_BODY') });
}
if (modules.includes('regex')) {
this.typeOptions.push({ 'id': FilterConditionType.Regex, 'name': 'Regex' });
this.typeOptions.push({ id: FilterConditionType.Regex, name: 'Regex' });
}
}
this.actionTypeOptions.push({ 'id': FilterAction.Discard, 'name': i18nFilter('ACTION_DISCARD') });
this.actionTypeOptions.push({ id: FilterAction.Discard, name: i18nFilter('ACTION_DISCARD') });
this.typeOptionsSize([
{ 'id': FilterConditionType.Over, 'name': i18nFilter('TYPE_OVER') },
{ 'id': FilterConditionType.Under, 'name': i18nFilter('TYPE_UNDER') }
{ id: FilterConditionType.Over, name: i18nFilter('TYPE_OVER') },
{ id: FilterConditionType.Under, name: i18nFilter('TYPE_UNDER') }
]);
this.typeOptionsBody([
{ 'id': FilterConditionType.Text, 'name': i18nFilter('TYPE_TEXT') },
{ 'id': FilterConditionType.Raw, 'name': i18nFilter('TYPE_RAW') }
{ id: FilterConditionType.Text, name: i18nFilter('TYPE_TEXT') },
{ id: FilterConditionType.Raw, name: i18nFilter('TYPE_RAW') }
]);
}

View File

@@ -29,7 +29,7 @@ class FolderClearPopupView extends AbstractViewPopup {
return folder ? folder.localName() : '';
},
dangerDescHtml: () => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { 'FOLDER': this.folderNameForClear() })
dangerDescHtml: () => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { FOLDER: this.folderNameForClear() })
});
decorateKoCommands(this, {

View File

@@ -74,13 +74,13 @@ class PluginPopupView extends AbstractViewPopup {
if (isNonEmptyArray(config)) {
this.configures(
config.map(item => ({
'value': ko.observable(item[0]),
'placeholder': ko.observable(item[6]),
'Name': item[1],
'Type': item[2],
'Label': item[3],
'Default': item[4],
'Desc': item[5]
value: ko.observable(item[0]),
placeholder: ko.observable(item[6]),
Name: item[1],
Type: item[2],
Label: item[3],
Default: item[4],
Desc: item[5]
}))
);
}

View File

@@ -114,15 +114,15 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
});
// append drag and drop
this.dragOver = ko.observable(false).extend({ 'throttle': 1 });
this.dragOverEnter = ko.observable(false).extend({ 'throttle': 1 });
this.dragOver = ko.observable(false).extend({ throttle: 1 });
this.dragOverEnter = ko.observable(false).extend({ throttle: 1 });
this.sLastSearchValue = '';
this.addComputables({
messageListSearchDesc: () => {
const value = MessageUserStore.listEndSearch();
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { 'SEARCH': value }) : ''
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { SEARCH: value }) : ''
},
messageListPaginator: computedPaginatorHelper(MessageUserStore.listPage,
@@ -871,9 +871,9 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
quotaTooltip() {
return i18n('MESSAGE_LIST/QUOTA_SIZE', {
'SIZE': FileInfo.friendlySize(this.userUsageSize()),
'PROC': this.userUsageProc(),
'LIMIT': FileInfo.friendlySize(this.userQuota())
SIZE: FileInfo.friendlySize(this.userUsageSize()),
PROC: this.userUsageProc(),
LIMIT: FileInfo.friendlySize(this.userQuota())
});
}

View File

@@ -732,7 +732,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
oMessage.folder,
oMessage.uid,
oMessage.readReceipt(),
i18n('READ_RECEIPT/SUBJECT', { 'SUBJECT': oMessage.subject() }),
i18n('READ_RECEIPT/SUBJECT', { SUBJECT: oMessage.subject() }),
i18n('READ_RECEIPT/BODY', { 'READ-RECEIPT': AccountUserStore.email() })
);