GosuGod
GosuGod

Reputation: 300

Is it possible to change default fallback message i18n-js?

I want to change fallback message on missing translation for i18n-js ([missing translation "en....."]) Is it possible and how to?

Upvotes: 1

Views: 1074

Answers (2)

GosuGod
GosuGod

Reputation: 300

Thanks @Vasfed, but now i know easier way to do this.

Just add:

I18n.t("some.missing.scope", {defaults: [{message: "Some message"}]});

Instead of [missing translation "bla.bla.bla" ] you will get "Some message".

Upvotes: 2

Vasfed
Vasfed

Reputation: 18504

In library itself it is defined this way:

I18n.missingTranslation = function() {
  var message = '[missing "' + this.currentLocale()
    , count = arguments.length
  ;

  for (var i = 0; i < count; i++) {
    message += "." + arguments[i];
  }

  message += '" translation]';

  return message;
};

you can replace this with your own implementation by reassigning I18n.missingTranslation after library is already evaluated.

Upvotes: 0

Related Questions