mui-language-picker
Version:
Material UI language picker
21 lines (20 loc) • 831 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDisplayName = void 0;
var getDisplayName = function (curName, tag, displayName) {
var _a;
// If user setup a custom language name
if (tag && curName !== tag.name)
return curName;
// If caller provided a custom name formatter
if (displayName)
return displayName(curName, tag);
// By default, show a local name (if present) and the name
var localName = tag
? tag.localname || (((_a = tag.localnames) === null || _a === void 0 ? void 0 : _a.length) ? tag.localnames[0] : undefined)
: undefined;
return localName && localName.toLowerCase() !== curName.toLowerCase()
? "".concat(localName, " / ").concat(curName)
: curName;
};
exports.getDisplayName = getDisplayName;