1
0
Fork 0

fix(core): Make mergeI18n methos more robust

This commit is contained in:
joostdecock 2023-07-02 13:50:46 +02:00
parent 52b5a8a6a2
commit 8fde32950c

View file

@ -444,7 +444,8 @@ export function lineIntersectsCurve(start, end, from, cp1, cp2, to) {
/**
* Helper method to merge translation files from different designs
*
* @param {object} translations - One or more translation objects
* @param {array} designs - One or more translation objects for designs
* @param {object} options - Configuration object for how to merge these designs
* @return {object} result - A merged object of translations
*/
export function mergeI18n(designs, options) {
@ -743,9 +744,9 @@ export function __macroName(name) {
*/
function __keepTranslation(key, options) {
// Drop it?
if (options.drop && options.drop.includes(key)) return false
if (options?.drop && options.drop.includes(key)) return false
// Keep only some and not this one?
if (options.keep && !options.keep.includes(key)) return false
if (options?.keep && !options.keep.includes(key)) return false
// Keep it
return true