locizify 5.5.0 → 6.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 +9 -0
- package/README.md +3 -2
- package/dist/commonjs/index.js +18 -5
- package/dist/es/index.js +19 -6
- package/dist/umd/locizify.js +3540 -416
- package/dist/umd/locizify.min.js +2 -2
- package/example/landing/index.html +1 -1
- package/example/simple/index.html +1 -1
- package/example/simple/server.js +1 -0
- package/locizify.js +3540 -416
- package/locizify.min.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -479,6 +479,9 @@ locizify.forceRerender();
|
|
|
479
479
|
|
|
480
480
|
## access to locize script (locize InContext editor)
|
|
481
481
|
|
|
482
|
+
Pass `?incontext=true` in your url to show the locize InContext editor.
|
|
483
|
+
|
|
484
|
+
|
|
482
485
|
https://github.com/locize/locize
|
|
483
486
|
|
|
484
487
|
```js
|
|
@@ -487,7 +490,5 @@ let isOff;
|
|
|
487
490
|
isOff = locizify.editor.turnOff(); // -> true
|
|
488
491
|
isOff = locizify.editor.turnOn(); // -> false
|
|
489
492
|
|
|
490
|
-
locizify.editor.showLocizeLink(); // -> shows link to open directly in locize InContext editor
|
|
491
|
-
|
|
492
493
|
locizify.editor.setEditorLng('en'); // -> sets the appropriate language in the InContext editor
|
|
493
494
|
```
|
package/dist/commonjs/index.js
CHANGED
|
@@ -29,10 +29,6 @@ var defaults = {
|
|
|
29
29
|
reloadOnSave: true,
|
|
30
30
|
bindSavedMissing: true
|
|
31
31
|
};
|
|
32
|
-
i18next.use(_i18nextLocizeBackend["default"]).use(_locize.locizePlugin);
|
|
33
|
-
i18next.on('editorSaved', function () {
|
|
34
|
-
_i18nextify["default"].forceRerender();
|
|
35
|
-
});
|
|
36
32
|
|
|
37
33
|
function getParameterByName(name) {
|
|
38
34
|
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href.toLowerCase();
|
|
@@ -44,6 +40,24 @@ function getParameterByName(name) {
|
|
|
44
40
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
45
41
|
}
|
|
46
42
|
|
|
43
|
+
var isInIframe = typeof window !== 'undefined';
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
// eslint-disable-next-line no-undef, no-restricted-globals
|
|
47
|
+
isInIframe = self !== top; // eslint-disable-next-line no-empty
|
|
48
|
+
} catch (e) {}
|
|
49
|
+
|
|
50
|
+
i18next.use(_i18nextLocizeBackend["default"]);
|
|
51
|
+
|
|
52
|
+
if (isInIframe) {
|
|
53
|
+
i18next.use(_locize.locizePlugin);
|
|
54
|
+
} else if (getParameterByName('incontext') === 'true') {
|
|
55
|
+
i18next.use(_locize.locizePlugin);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
i18next.on('editorSaved', function () {
|
|
59
|
+
_i18nextify["default"].forceRerender();
|
|
60
|
+
});
|
|
47
61
|
var originalInit = i18next.init;
|
|
48
62
|
|
|
49
63
|
i18next.init = function () {
|
|
@@ -145,7 +159,6 @@ _i18nextify["default"].getOptions = function (callback) {
|
|
|
145
159
|
_i18nextify["default"].editor = {
|
|
146
160
|
turnOn: _locize.turnOn,
|
|
147
161
|
turnOff: _locize.turnOff,
|
|
148
|
-
showLocizeLink: _locize.showLocizeLink,
|
|
149
162
|
setEditorLng: _locize.setEditorLng
|
|
150
163
|
};
|
|
151
164
|
var _default = _i18nextify["default"];
|
package/dist/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
|
|
8
8
|
import i18nextify from 'i18nextify';
|
|
9
9
|
import LocizeBackend from 'i18next-locize-backend';
|
|
10
|
-
import { locizePlugin, turnOn, turnOff,
|
|
10
|
+
import { locizePlugin, turnOn, turnOff, setEditorLng } from 'locize';
|
|
11
11
|
var i18next = i18nextify.i18next;
|
|
12
12
|
var enforce = {
|
|
13
13
|
saveMissingTo: 'all'
|
|
@@ -16,10 +16,6 @@ var defaults = {
|
|
|
16
16
|
reloadOnSave: true,
|
|
17
17
|
bindSavedMissing: true
|
|
18
18
|
};
|
|
19
|
-
i18next.use(LocizeBackend).use(locizePlugin);
|
|
20
|
-
i18next.on('editorSaved', function () {
|
|
21
|
-
i18nextify.forceRerender();
|
|
22
|
-
});
|
|
23
19
|
|
|
24
20
|
function getParameterByName(name) {
|
|
25
21
|
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href.toLowerCase();
|
|
@@ -31,6 +27,24 @@ function getParameterByName(name) {
|
|
|
31
27
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
32
28
|
}
|
|
33
29
|
|
|
30
|
+
var isInIframe = typeof window !== 'undefined';
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
// eslint-disable-next-line no-undef, no-restricted-globals
|
|
34
|
+
isInIframe = self !== top; // eslint-disable-next-line no-empty
|
|
35
|
+
} catch (e) {}
|
|
36
|
+
|
|
37
|
+
i18next.use(LocizeBackend);
|
|
38
|
+
|
|
39
|
+
if (isInIframe) {
|
|
40
|
+
i18next.use(locizePlugin);
|
|
41
|
+
} else if (getParameterByName('incontext') === 'true') {
|
|
42
|
+
i18next.use(locizePlugin);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
i18next.on('editorSaved', function () {
|
|
46
|
+
i18nextify.forceRerender();
|
|
47
|
+
});
|
|
34
48
|
var originalInit = i18next.init;
|
|
35
49
|
|
|
36
50
|
i18next.init = function () {
|
|
@@ -132,7 +146,6 @@ i18nextify.getOptions = function (callback) {
|
|
|
132
146
|
i18nextify.editor = {
|
|
133
147
|
turnOn: turnOn,
|
|
134
148
|
turnOff: turnOff,
|
|
135
|
-
showLocizeLink: showLocizeLink,
|
|
136
149
|
setEditorLng: setEditorLng
|
|
137
150
|
};
|
|
138
151
|
export default i18nextify;
|