How to use the exists function from i18next

Find comprehensive JavaScript i18next.exists code examples handpicked from public code repositorys.

124
125
126
127
128
129
130
131
132
133
i18n.getCurrentLocale = function() {
    return i18next.language;
};

i18n.existsMessage = function(key) {
    return i18next.exists(key);
};

/**
 * Helper functions, don't depend of the i18n framework
fork icon6
star icon46
watch icon6

22
23
24
25
26
27
28
29
30
31

i18n.use(backend)
  .init(initOptions);

function t(key, vars) {
  if (isNaN(key) && i18n.exists(key)) {
    return vars ? i18n.t(key, vars) : i18n.t(key);
  }

  return key;
fork icon3
star icon22
watch icon3