Sha256: 334ff764a1b82c86b31b820ac176fd6a7018c1fdda96234035d15a107ab01543
Contents?: true
Size: 646 Bytes
Versions: 3
Compression:
Stored size: 646 Bytes
Contents
import md5 from "md5"; function onMissingTranslation(I18n, md5, message) { return `translation missing: ${I18n.locale}.${message}`; } const interpolate = (message, data) => message.replace(/%{([^{}]*)}/g, (a, b) => data[b]); export default function configure(I18n) { I18n.screw = function screw(message, data) { const hash = md5(message); let translation = I18n.translations[I18n.locale]?.[hash]; if (typeof translation === "undefined") { translation = onMissingTranslation(I18n, hash, message); } const [context, phrase] = translation.split("|"); return interpolate(phrase ?? context ?? "", data); }; }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
i18n_screwdriver-12.1.1 | package/src/index.js |
i18n_screwdriver-12.1.0 | package/src/index.js |
i18n_screwdriver-12.0.0 | package/src/index.js |