Fix travis's syntaxe conventions errors
parent
a2d4083e95
commit
8112bf929c
11
index.js
11
index.js
|
@ -22,7 +22,7 @@ const DEFAULT_OPTIONS = {
|
|||
dir: undefined,
|
||||
dirs: [path.join(process.cwd(), 'locales')],
|
||||
functionName: '__',
|
||||
functionnName: '__n'
|
||||
functionnName: '__n',
|
||||
};
|
||||
|
||||
module.exports = function (app, options) {
|
||||
|
@ -137,7 +137,6 @@ module.exports = function (app, options) {
|
|||
|
||||
app[functionName] = gettext;
|
||||
|
||||
|
||||
function gettextn(locale, key, count, value) {
|
||||
if (arguments.length === 0 || arguments.length === 1) {
|
||||
// __n()
|
||||
|
@ -158,25 +157,25 @@ module.exports = function (app, options) {
|
|||
//**************************************************************//
|
||||
// Directly adapted from __n function of i18n module :
|
||||
// https://github.com/mashpie/i18n-node/blob/master/i18n.js
|
||||
var p;
|
||||
let p;
|
||||
// create a new Plural for locale
|
||||
// and try to cache instance
|
||||
if (PluralsForLocale[locale]) {
|
||||
p = PluralsForLocale[locale];
|
||||
} else {
|
||||
// split locales with a region code
|
||||
var lc = locale.toLowerCase().split(/[_-\s]+/)
|
||||
let lc = locale.toLowerCase().split(/[_-\s]+/)
|
||||
.filter(function(el){ return true && el; });
|
||||
// take the first part of locale, fallback to full locale
|
||||
p = MakePlural[lc[0] || locale];
|
||||
PluralsForLocale[locale] = p;
|
||||
}
|
||||
// fallback to 'other' on case of missing translations
|
||||
let text = resource[key+"."+p(count)] || resource[key+".other"];
|
||||
let text = resource[key + '.' + p(count)] || resource[key + '.other'];
|
||||
//**************************************************************//
|
||||
|
||||
if (text === undefined && isObject(key)) {
|
||||
text = key[p(count)] || key["other"];
|
||||
text = key[p(count)] || key['other'];
|
||||
}
|
||||
|
||||
if (text === undefined) {
|
||||
|
|
Loading…
Reference in New Issue