openapi-explorer 2.1.645 → 2.1.647

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import i18next from 'i18next';
2
2
  import en from './en.js';
3
3
  import fr from './fr.js';
4
- export async function initI18n() {
5
- const initLang = window.navigator.language.substring(0, 2);
4
+ export async function initI18n(resolvedSpecLanguage) {
5
+ const initLang = (resolvedSpecLanguage || window.navigator.language).substring(0, 2);
6
6
  await i18next.init({
7
7
  lng: initLang,
8
8
  fallbackLng: 'en',
@@ -270,7 +270,6 @@ export default class OpenApiExplorer extends LitElement {
270
270
  this.handleResize = this.handleResize.bind(this);
271
271
  window.addEventListener('resize', this.handleResize);
272
272
  this.loading = true;
273
- initI18n();
274
273
  const parent = this.parentElement;
275
274
 
276
275
  if (parent) {
@@ -456,6 +455,8 @@ export default class OpenApiExplorer extends LitElement {
456
455
  this.matchPaths = '';
457
456
 
458
457
  try {
458
+ var _spec$info;
459
+
459
460
  this.resolvedSpec = null;
460
461
  this.loading = true;
461
462
  this.loadFailed = false;
@@ -468,6 +469,8 @@ export default class OpenApiExplorer extends LitElement {
468
469
  return;
469
470
  }
470
471
 
472
+ initI18n((_spec$info = spec.info) === null || _spec$info === void 0 ? void 0 : _spec$info['x-locale']);
473
+
471
474
  if (!this.serverUrl) {
472
475
  var _spec$servers$, _spec$servers$2;
473
476
 
@@ -12,8 +12,8 @@ var _fr = _interopRequireDefault(require("./fr.js"));
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
- async function initI18n() {
16
- const initLang = window.navigator.language.substring(0, 2);
15
+ async function initI18n(resolvedSpecLanguage) {
16
+ const initLang = (resolvedSpecLanguage || window.navigator.language).substring(0, 2);
17
17
  await _i18next.default.init({
18
18
  lng: initLang,
19
19
  fallbackLng: 'en',
@@ -300,7 +300,6 @@ class OpenApiExplorer extends _lit.LitElement {
300
300
  this.handleResize = this.handleResize.bind(this);
301
301
  window.addEventListener('resize', this.handleResize);
302
302
  this.loading = true;
303
- (0, _index.initI18n)();
304
303
  const parent = this.parentElement;
305
304
 
306
305
  if (parent) {
@@ -486,6 +485,8 @@ class OpenApiExplorer extends _lit.LitElement {
486
485
  this.matchPaths = '';
487
486
 
488
487
  try {
488
+ var _spec$info;
489
+
489
490
  this.resolvedSpec = null;
490
491
  this.loading = true;
491
492
  this.loadFailed = false;
@@ -498,6 +499,8 @@ class OpenApiExplorer extends _lit.LitElement {
498
499
  return;
499
500
  }
500
501
 
502
+ (0, _index.initI18n)((_spec$info = spec.info) === null || _spec$info === void 0 ? void 0 : _spec$info['x-locale']);
503
+
501
504
  if (!this.serverUrl) {
502
505
  var _spec$servers$, _spec$servers$2;
503
506
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.1.645",
3
+ "version": "2.1.647",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Authress Developers <developers@authress.io>",
6
6
  "type": "module",