Sha256: 37129fc5e09c6e8999e10ac473575544e270de95c0a38a468cb1492e2e8b13fb

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

//= require i18n_screwdriver/md5

const interpolate = (message, data) =>
  message.replace(/%{([^{}]*)}/g, (a, b) => data[b]);

I18n.screw = function(message, data) {
  const md5 = window.md5(message);
  let translation = I18n.translations[I18n.locale][md5];
  if (translation == null) {
    translation = I18n.onMissingTranslation(md5, message);
  }

  const [context, phrase] = translation.split("|")
  return interpolate(phrase ?? context ?? "", data);
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n_screwdriver-12.0.0 app/assets/javascrips/i18n_screwdriver/screw.js