• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

i18next / i18next / #61089

19 Sep 2021 08:27AM UTC coverage: 93.967%. Remained the same
#61089

push

adrai
remove deprecated whitelist features

1028 of 1094 relevant lines covered (93.97%)

107.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
/src/defaults.js
1
export function get() {
1✔
2
  return {
21✔
3
    debug: false,
4
    initImmediate: true,
5

6
    ns: ['translation'],
7
    defaultNS: ['translation'],
8
    fallbackLng: ['dev'],
9
    fallbackNS: false, // string or array of namespaces
10

11
    supportedLngs: false, // array with supported languages
12
    nonExplicitSupportedLngs: false,
13
    load: 'all', // | currentOnly | languageOnly
14
    preload: false, // array with preload languages
15

16
    simplifyPluralSuffix: true,
17
    keySeparator: '.',
18
    nsSeparator: ':',
19
    pluralSeparator: '_',
20
    contextSeparator: '_',
21

22
    partialBundledLanguages: false, // allow bundling certain languages that are not remotely fetched
23
    saveMissing: false, // enable to send missing values
24
    updateMissing: false, // enable to update default values if different from translated value (only useful on initial development, or when keeping code as source of truth)
25
    saveMissingTo: 'fallback', // 'current' || 'all'
26
    saveMissingPlurals: true, // will save all forms not only singular key
27
    missingKeyHandler: false, // function(lng, ns, key, fallbackValue) -> override if prefer on handling
28
    missingInterpolationHandler: false, // function(str, match)
29

30
    postProcess: false, // string or array of postProcessor names
31
    postProcessPassResolved: false, // pass resolved object into 'options.i18nResolved' for postprocessor
32
    returnNull: true, // allows null value as valid translation
33
    returnEmptyString: true, // allows empty string value as valid translation
34
    returnObjects: false,
35
    joinArrays: false, // or string to join array
36
    returnedObjectHandler: false, // function(key, value, options) triggered if key returns object but returnObjects is set to false
37
    parseMissingKeyHandler: false, // function(key) parsed a key that was not found in t() before returning
38
    appendNamespaceToMissingKey: false,
39
    appendNamespaceToCIMode: false,
40
    overloadTranslationOptionHandler: function handle(args) {
41
      var ret = {};
30✔
42
      if (typeof args[1] === 'object') ret = args[1];
30✔
43
      if (typeof args[1] === 'string') ret.defaultValue = args[1];
30✔
44
      if (typeof args[2] === 'string') ret.tDescription = args[2];
30✔
45
      if (typeof args[2] === 'object' || typeof args[3] === 'object') {
30✔
46
        var options = args[3] || args[2];
4✔
47
        Object.keys(options).forEach(function(key) {
4✔
48
          ret[key] = options[key];
6✔
49
        });
50
      }
51
      return ret;
30✔
52
    },
53
    interpolation: {
54
      escapeValue: true,
55
      format: (value, format, lng, options) => value,
1✔
56
      prefix: '{{',
57
      suffix: '}}',
58
      formatSeparator: ',',
59
      // prefixEscaped: '{{',
60
      // suffixEscaped: '}}',
61
      // unescapeSuffix: '',
62
      unescapePrefix: '-',
63

64
      nestingPrefix: '$t(',
65
      nestingSuffix: ')',
66
      nestingOptionsSeparator: ',',
67
      // nestingPrefixEscaped: '$t(',
68
      // nestingSuffixEscaped: ')',
69
      // defaultVariables: undefined // object that can have values to interpolate on - extends passed in interpolation data
70
      maxReplaces: 1000, // max replaces to prevent endless loop
71
      skipOnVariables: true,
72
    },
73
  };
74
}
75

76
/* eslint no-param-reassign: 0 */
77
export function transformOptions(options) {
1✔
78
  // create namespace object if namespace is passed in as string
79
  if (typeof options.ns === 'string') options.ns = [options.ns];
34✔
80
  if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
34✔
81
  if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
34✔
82

83
  // extend supportedLngs with cimode
84
  if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
34✔
85
    options.supportedLngs = options.supportedLngs.concat(['cimode']);
×
86
  }
87

88
  return options;
34✔
89
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc