locizify 8.0.1 → 9.0.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 9.0.0
2
+
3
+ - update i18next-locize-backend
4
+ - changed default cdnType to "standard" instead of "prod"
5
+
6
+ ### 8.0.2
7
+
8
+ - update i18next-locize-backend
9
+
1
10
  ### 8.0.1
2
11
 
3
12
  - update i18next-locize-backend
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 locize
3
+ Copyright (c) 2016-present locize
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -12,7 +12,7 @@ Just drop the following line to your header to deliver your content in any langu
12
12
  id="locizify"
13
13
  projectid="[PROJECT_ID]"
14
14
  apikey="[API_KEY]"
15
- src="https://unpkg.com/locizify@^8.0.0"
15
+ src="https://unpkg.com/locizify@^9.0.0"
16
16
  autopilot="true"
17
17
  cdnType="standard"
18
18
  ></script>
@@ -22,7 +22,7 @@ Just drop the following line to your header to deliver your content in any langu
22
22
  id="locizify"
23
23
  projectid="[PROJECT_ID]"
24
24
  apikey="[API_KEY]"
25
- src="https://cdn.jsdelivr.net/npm/locizify@^8.0.0"
25
+ src="https://cdn.jsdelivr.net/npm/locizify@^9.0.0"
26
26
  autopilot="true"
27
27
  cdnType="standard"
28
28
  ></script>
@@ -71,7 +71,7 @@ Add the script to your page:
71
71
  id="locizify"
72
72
  projectid="[PROJECT_ID]"
73
73
  apikey="[API_KEY]"
74
- src="https://unpkg.com/locizify@^8.0.0"
74
+ src="https://unpkg.com/locizify@^9.0.0"
75
75
  autopilot
76
76
  cdnType="standard"
77
77
  ></script>
@@ -105,7 +105,7 @@ Add the script to your page:
105
105
  apikey="[API_KEY]"
106
106
  referencelng="[LNG]"
107
107
  fallbacklng="[LNG]"
108
- src="https://unpkg.com/locizify@^8.0.0"
108
+ src="https://unpkg.com/locizify@^9.0.0"
109
109
 
110
110
  // all custom attributes can also be prefixed with data-
111
111
  // data-projectid="[PROJECT_ID]"
@@ -120,7 +120,7 @@ Add the script to your page:
120
120
  debug="[true|false (default false)]"
121
121
  autopilot="[true|false (default false)]" // automatically configures fallbackLng and supportedLngs
122
122
  load="[all|currentOnly|languageOnly (default all)]" // https://www.i18next.com/overview/configuration-options
123
- cdnType="[standard|pro (default pro)]"
123
+ cdnType="[standard|pro (default standard)]"
124
124
 
125
125
  // others
126
126
  // you can define any other option below just use the lowercased name and for arrays use comma separated values, eg.:
@@ -136,7 +136,7 @@ Add the script to your page:
136
136
  <!DOCTYPE html>
137
137
  <html>
138
138
  <head>
139
- <script src="https://unpkg.com/locizify@^8.0.0"></script>
139
+ <script src="https://unpkg.com/locizify@^9.0.0"></script>
140
140
  <script>
141
141
  locizify.init({
142
142
  // required
@@ -151,7 +151,7 @@ Add the script to your page:
151
151
  allowedAddOrUpdateHosts: ['localhost']
152
152
  // alternatively, pass a function:
153
153
  allowedAddOrUpdateHosts: function(hostname) { return hostname.endsWith('staging.example.com') },
154
- cdnType: 'standard' // default 'pro'
154
+ cdnType: 'pro' // default 'standard'
155
155
  },
156
156
 
157
157
  // defaults that are set
@@ -7424,7 +7424,7 @@
7424
7424
  return ("string" === r ? String : Number)(t);
7425
7425
  }
7426
7426
  var getApiPaths = function getApiPaths(cdnType) {
7427
- if (!cdnType) cdnType = 'pro';
7427
+ if (!cdnType) cdnType = 'standard';
7428
7428
  return {
7429
7429
  loadPath: "https://api".concat(cdnType === 'standard' ? '.lite' : '', ".locize.app/{{projectId}}/{{version}}/{{lng}}/{{ns}}"),
7430
7430
  privatePath: "https://api".concat(cdnType === 'standard' ? '.lite' : '', ".locize.app/private/{{projectId}}/{{version}}/{{lng}}/{{ns}}"),
@@ -7434,7 +7434,7 @@
7434
7434
  };
7435
7435
  };
7436
7436
  var getDefaults$3 = function getDefaults(cdnType) {
7437
- if (!cdnType) cdnType = 'pro';
7437
+ if (!cdnType) cdnType = 'standard';
7438
7438
  return defaults$1({
7439
7439
  cdnType: cdnType,
7440
7440
  noCache: false,
@@ -7590,12 +7590,6 @@
7590
7590
  Object.keys(apiPaths).forEach(function (ap) {
7591
7591
  if (!orgPassedOptions[ap]) _this.options[ap] = apiPaths[ap];
7592
7592
  });
7593
- if (!orgPassedOptions.cdnType) {
7594
- console.error('[i18next-locize-backend] In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your options to avoid missing translations.');
7595
- }
7596
- if (this.options.pull) {
7597
- console.warn('The pull API was removed use "private: true" option instead: https://www.locize.com/docs/api#fetch-private-namespace-resources');
7598
- }
7599
7593
  if (allOptions.debug && orgPassedOptions.noCache === undefined && this.options.cdnType === 'standard') {
7600
7594
  this.options.noCache = true;
7601
7595
  }
@@ -7692,7 +7686,7 @@
7692
7686
  this.isProjectNotExisting = true;
7693
7687
  }
7694
7688
  if (this.isProjectNotExisting) {
7695
- callback(new Error("locize project ".concat(this.options.projectId, " does not exist!")));
7689
+ callback(new Error(this.isProjectNotExistingErrorMessage));
7696
7690
  return deferred;
7697
7691
  }
7698
7692
  this.getLanguagesCalls = this.getLanguagesCalls || [];
@@ -7702,12 +7696,26 @@
7702
7696
  if (!_this3.somethingLoaded && info && info.resourceNotExisting) {
7703
7697
  _this3.isProjectNotExisting = true;
7704
7698
  _this3.storage.setProjectNotExisting(_this3.options.projectId);
7705
- var e = new Error("locize project ".concat(_this3.options.projectId, " does not exist!"));
7706
- var _clbs = _this3.getLanguagesCalls;
7707
- _this3.getLanguagesCalls = [];
7708
- return _clbs.forEach(function (clb) {
7709
- return clb(e);
7699
+ var errMsg = "locize project ".concat(_this3.options.projectId, " does not exist!");
7700
+ _this3.isProjectNotExistingErrorMessage = errMsg;
7701
+ var cdnTypeAlt = _this3.options.cdnType === 'standard' ? 'pro' : 'standard';
7702
+ var otherEndpointApiPaths = getApiPaths(cdnTypeAlt);
7703
+ var urlAlt = interpolate(otherEndpointApiPaths.getLanguagesPath, {
7704
+ projectId: _this3.options.projectId
7705
+ });
7706
+ _this3.loadUrl({}, urlAlt, function (errAlt, retAlt, infoAlt) {
7707
+ if (!errAlt && retAlt && (!infoAlt || !infoAlt.resourceNotExisting)) {
7708
+ errMsg += " It seems you're using the wrong cdnType. Your locize project is configured to use \"".concat(cdnTypeAlt, "\" but here you've configured \"").concat(_this3.options.cdnType, "\".");
7709
+ _this3.isProjectNotExistingErrorMessage = errMsg;
7710
+ }
7711
+ var e = new Error(errMsg);
7712
+ var clbs = _this3.getLanguagesCalls;
7713
+ _this3.getLanguagesCalls = [];
7714
+ clbs.forEach(function (clb) {
7715
+ return clb(e);
7716
+ });
7710
7717
  });
7718
+ return;
7711
7719
  }
7712
7720
  if (ret) {
7713
7721
  _this3.loadedLanguages = Object.keys(ret);
@@ -7847,7 +7855,7 @@
7847
7855
  this.isProjectNotExisting = true;
7848
7856
  }
7849
7857
  if (this.isProjectNotExisting) {
7850
- var err = new Error("locize project ".concat(this.options.projectId, " does not exist!"));
7858
+ var err = new Error(this.isProjectNotExistingErrorMessage);
7851
7859
  if (logger) logger.error(err.message);
7852
7860
  if (callback) callback(err);
7853
7861
  return;