add-locale.js 628 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.addLocale = addLocale;
  6. var _addPathPrefix = require("./add-path-prefix");
  7. var _pathHasPrefix = require("./path-has-prefix");
  8. function addLocale(path, locale, defaultLocale, ignorePrefix) {
  9. if (locale && locale !== defaultLocale && (ignorePrefix || !(0, _pathHasPrefix).pathHasPrefix(path.toLowerCase(), `/${locale.toLowerCase()}`) && !(0, _pathHasPrefix).pathHasPrefix(path.toLowerCase(), '/api'))) {
  10. return (0, _addPathPrefix).addPathPrefix(path, `/${locale}`);
  11. }
  12. return path;
  13. }
  14. //# sourceMappingURL=add-locale.js.map