tinify-client
Version:
A CLI to compress your images not only intelligently but also to the EXTREME!
28 lines (27 loc) • 831 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.i18n = void 0;
const en_US_1 = __importDefault(require("./en-US"));
const zh_CN_1 = __importDefault(require("./zh-CN"));
function getLanguage() {
const envLang = process.env.LANG;
const lang = Intl.DateTimeFormat().resolvedOptions().locale;
return envLang || lang;
}
function i18n(language = '') {
const lang = language || getLanguage();
let dictionary;
switch (lang) {
case 'zh-CN':
dictionary = zh_CN_1.default;
break;
default:
dictionary = en_US_1.default;
break;
}
return dictionary;
}
exports.i18n = i18n;