fix: return empty if the key-value is empty value
PR-URL: https://github.com/koajs/locales/pull/17 Reviewed-By: fengmk2 <fengmk2@gmail.com> Reviewed-By: dead-horse <heyiyu.deadhorse@gmail.com>
This commit is contained in:
10
index.js
10
index.js
@@ -1,6 +1,4 @@
|
||||
/**!
|
||||
* koa-locales - index.js
|
||||
*
|
||||
/**
|
||||
* Copyright(c) koajs and other contributors.
|
||||
* MIT Licensed
|
||||
*
|
||||
@@ -87,7 +85,11 @@ module.exports = function (app, options) {
|
||||
const locale = this.__getLocale();
|
||||
const resource = resources[locale] || {};
|
||||
|
||||
const text = resource[key] || key;
|
||||
let text = resource[key];
|
||||
if (text === undefined) {
|
||||
text = key;
|
||||
}
|
||||
|
||||
debug('%s: %j => %j', locale, key, text);
|
||||
if (!text) {
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user