This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Proccess all the input array and calls `getTranslation` onEach row | |
* @param {Array} arr, array of objects term to be translated in the shape of `{key:"", value:""}`, eg. `{key:"fullName", value:"Full name"} | |
* @returns {Promise} resolved array is in the same shape as input | |
*/ | |
const processTranslation = (arr, target = "de", api_key = process.env.GKEY) => { | |
return new Promise((resolve) => { | |
/** | |
* | |
* @param {Array} arr input variables array. Terms to be translated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts object to array | |
* @param {Object} obj | |
* @returns {Array} | |
* @example | |
* | |
* convertToArray({fullName:"Full Name"}) // returns [{key:"fullName", value:"Full name"}] | |
*/ | |
const convertToArray = obj => | |
Object.keys(obj).map(key => ({ key, value: obj[key] })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calls the translation.googleapis | |
* @param {Object} term, term to be translated the shape of `{key:"", value:""}`, eg. `{key:"fullName", value:"Full name"} | |
* @param {String} target language code eg `en` | |
* @param {String} key Google Api Key generated with `gcloud auth application-default print-access-token` | |
* @returns {Promise} resolve object is in the same shape as input | |
*/ | |
const getTranslation = (term, target, key) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
|--------| | |
/--X--| SMTP 1 | | |
/ ^ |--------| | |
/ \--- Retry with next provider | |
|----------------|/ |--------| |------------------| | |
| Mail | ---X--> | SMTP 2 | /->| ^_^ Happy user | | |
|----------------|\ ^ |--------| / |------------------| | |
\ \--- Retry / | |
\ |--------| / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).on('hashchange', function() { | |
var i = parseInt(window.location.hash.substr(1)); | |
if (isFinite(i) && $.fancybox.isOpen) { $.fancybox.jumpto(i) } | |
}) |
NewerOlder