Sha256: 413bc36f08ef07bcd26072cd1a843578cfd9e63b69cca1289d1fc437726a5b22

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

{"version":3,"file":"index.umd.js","sources":["../package/src/index.js"],"sourcesContent":["import md5 from \"md5\";\n\nfunction onMissingTranslation(I18n, md5, message) {\n  return `translation missing: ${I18n.locale}.${message}`;\n}\n\nconst interpolate = (message, data) =>\n  message.replace(/%{([^{}]*)}/g, (a, b) => data[b]);\n\nexport default function configure(I18n) {\n  I18n.screw = function screw(message, data) {\n    const hash = md5(message);\n    let translation = I18n.translations[I18n.locale]?.[hash];\n    if (typeof translation === \"undefined\") {\n      translation = onMissingTranslation(I18n, hash, message);\n    }\n\n    const [context, phrase] = translation.split(\"|\");\n    return interpolate(phrase ?? context ?? \"\", data);\n  };\n}\n"],"names":["I18n","screw","message","data","hash","md5","translation","translations","locale","_I18n$translations$I","onMissingTranslation","split","phrase","replace","a","b","interpolate"],"mappings":"uSASkCA,GAChCA,EAAKC,MAAQ,SAAeC,EAASC,WAC7BC,EAAOC,EAAIH,GACbI,YAAcN,EAAKO,aAAaP,EAAKQ,4BAAvBC,EAAiCL,QACxB,IAAhBE,IACTA,EAZN,SAA8BN,EAAMK,EAAKH,GACvC,8BAA+BF,EAAKQ,WAAUN,EAW5BQ,CAAqBV,EAAMI,EAAMF,IAJR,MAOfI,EAAYK,MAAM,KAA5BC,OAChB,OAZgB,SAACV,EAASC,UAC5BD,EAAQW,QAAQ,eAAgB,SAACC,EAAGC,UAAMZ,EAAKY,KAWtCC,gBAAYJ,EAAAA,UAAqB,GAAIT"}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n_screwdriver-12.0.0 dist/index.umd.js.map