arb-convert
Version:
Convert Application Resource Bundle (ARB) translation files to other translation formats and back
21 lines (20 loc) • 687 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function parseLocale() {
var candidates = [];
for (var _i = 0; _i < arguments.length; _i++) {
candidates[_i] = arguments[_i];
}
// eslint-disable-next-line no-restricted-syntax
for (var _a = 0, candidates_1 = candidates; _a < candidates_1.length; _a++) {
var candidate = candidates_1[_a];
if (candidate != null) {
var matches = candidate.match(/(^|[\W_])([a-z]{2}[-_][A-Z]{2})($|[\W_])/);
if (matches) {
return matches[2].replace('_', '-');
}
}
}
return undefined;
}
exports.default = parseLocale;