Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.

Commit

Permalink
Set locale fallback to default when current locale is not defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Aug 6, 2016
1 parent b905751 commit d10d892
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/bagoftext.js
Expand Up @@ -10,7 +10,7 @@ var fs = require('fs'),
* @param {String} base: base directory where the client module is located,
* used as a base directory to read locale .json files,
* ideally the value would be the client's __dirname
* @param {Object} opts:
* @param {Object} opts:
* - defaultLocale: default locale, defaults to en
* - localesDir: directory where locale files are from base directory, defaults to conf/locales/
*/
Expand Down Expand Up @@ -45,7 +45,7 @@ function initLocales(base, opts) {
};

i18n.configure(i18nOpts);
i18n.setLocale(_currLocale());
i18n.setLocale(_currLocale() || i18nOpts.defaultLocale);
}

/**
Expand Down
1 change: 0 additions & 1 deletion test/bagoftext.js
Expand Up @@ -69,4 +69,3 @@ buster.testCase('text - __', {
assert.equals(bag.__('name %s, age %d'), 'nama %s, umur %d');
}
});

0 comments on commit d10d892

Please sign in to comment.