locizify 5.0.2 → 5.0.3
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 +5 -0
- package/README.md +1 -4
- package/dist/commonjs/index.js +2 -16
- package/dist/es/index.js +2 -16
- package/dist/umd/locizify.js +946 -769
- package/dist/umd/locizify.min.js +2 -2
- package/example/index.html +0 -9
- package/example/node_modules/send/node_modules/ms/index.js +162 -0
- package/example/node_modules/send/node_modules/ms/license.md +21 -0
- package/example/node_modules/send/node_modules/ms/package.json +69 -0
- package/example/node_modules/send/node_modules/ms/readme.md +60 -0
- package/locizify.js +946 -769
- package/locizify.min.js +2 -2
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -41,7 +41,6 @@ Per default only `localhost` is allowed to send missing keys ([or update missing
|
|
|
41
41
|
|
|
42
42
|
locizify wraps some other modules from locize and i18next so there are additional valuable resources to read to get details on all the provided options:
|
|
43
43
|
|
|
44
|
-
- locize editor: `?locize=true` --> [readme](https://github.com/locize/locize-editor)
|
|
45
44
|
- i18next language detector: `?lng=de` --> [readme](https://github.com/i18next/i18next-browser-languageDetector)
|
|
46
45
|
- locize backend --> [readme](https://github.com/locize/i18next-locize-backend)
|
|
47
46
|
- i18next --> [website](https://www.i18next.com)
|
|
@@ -77,7 +76,7 @@ Add the script to your page:
|
|
|
77
76
|
|
|
78
77
|
4. Reload your page with `?lng='[newLanguage]'`
|
|
79
78
|
|
|
80
|
-
5. Reload your page
|
|
79
|
+
5. Reload your page in the locize incontext editor to directly translate on page.
|
|
81
80
|
|
|
82
81
|
## Initialize with optional options
|
|
83
82
|
|
|
@@ -101,7 +100,6 @@ Add the script to your page:
|
|
|
101
100
|
savemissing="[true|false (default true)]"
|
|
102
101
|
allowedAddOrUpdateHost="[mydomain.com (default localhost)]"
|
|
103
102
|
debug="[true|false (default false)]"
|
|
104
|
-
reloadonsave="[true|false (default true)]" // automatically reload your page on saving in editor
|
|
105
103
|
autopilot="[true|false (default false)]" // automatically configures fallbackLng and supportedLngs
|
|
106
104
|
load="[all|currentOnly|languageOnly (default all)]" // https://www.i18next.com/overview/configuration-options
|
|
107
105
|
|
|
@@ -138,7 +136,6 @@ Add the script to your page:
|
|
|
138
136
|
|
|
139
137
|
// defaults that are set
|
|
140
138
|
bindSavedMissing: true, // will connect backend supporting onSaved and trigger a reload on saved missings
|
|
141
|
-
reloadOnSave: true, // automatically reload your page on saving in editor
|
|
142
139
|
autorun: true, // setting to false init will return an object with start function
|
|
143
140
|
ele: document.body, // pass in another element if you like to translate another html element
|
|
144
141
|
ignoreTags: ['SCRIPT'], // tags to ignore
|
package/dist/commonjs/index.js
CHANGED
|
@@ -15,8 +15,6 @@ var _i18nextify = _interopRequireDefault(require("i18nextify"));
|
|
|
15
15
|
|
|
16
16
|
var _i18nextLocizeBackend = _interopRequireDefault(require("i18next-locize-backend"));
|
|
17
17
|
|
|
18
|
-
var _locizeEditor = _interopRequireDefault(require("locize-editor"));
|
|
19
|
-
|
|
20
18
|
var _locize = require("locize");
|
|
21
19
|
|
|
22
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -38,9 +36,7 @@ var reloadEditorOptions = {
|
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
};
|
|
41
|
-
|
|
42
|
-
i18next.use(_i18nextLocizeBackend["default"]).use(_locize.locizePlugin).use(_locizeEditor["default"]); // locize-editor is for old client
|
|
43
|
-
|
|
39
|
+
i18next.use(_i18nextLocizeBackend["default"]).use(_locize.locizePlugin);
|
|
44
40
|
i18next.on('editorSaved', function () {
|
|
45
41
|
_i18nextify["default"].forceRerender();
|
|
46
42
|
});
|
|
@@ -55,7 +51,7 @@ i18next.init = function () {
|
|
|
55
51
|
if (scriptEle) {
|
|
56
52
|
var config = {};
|
|
57
53
|
var backend = {};
|
|
58
|
-
var toRead = ['fallbackLng', 'saveMissing', 'debug', '
|
|
54
|
+
var toRead = ['fallbackLng', 'saveMissing', 'debug', 'autorun', 'ele', 'cleanIndent', 'cleanWhitespace', 'namespace', 'namespaceFromPath', 'load'];
|
|
59
55
|
var toReadAsArray = ['ignoreTags', 'ignoreIds', 'ignoreClasses', 'translateAttributes', 'mergeTags', 'inlineTags', 'ignoreInlineOn', 'ignoreCleanIndentFor', 'ns'];
|
|
60
56
|
var toReadBackend = ['projectId', 'apiKey', 'referenceLng', 'version', 'allowedAddOrUpdateHost'];
|
|
61
57
|
toRead.forEach(function (attr) {
|
|
@@ -86,16 +82,6 @@ i18next.init = function () {
|
|
|
86
82
|
options.backend = _objectSpread(_objectSpread({}, options.backend), backend);
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
if ( // locize-editor is for old client
|
|
90
|
-
options.reloadOnSave && (!options.editor || !options.editor.onEditorSaved)) options.editor = _objectSpread(_objectSpread({}, options.editor), reloadEditorOptions);
|
|
91
|
-
|
|
92
|
-
if (options.bindSavedMissing) {
|
|
93
|
-
// locize-editor is for old client
|
|
94
|
-
options.backend.onSaved = function (lng, ns) {
|
|
95
|
-
_locizeEditor["default"].handleSavedMissing(lng, ns);
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
85
|
function handleI18nextInitialized(err, t) {
|
|
100
86
|
// ready now
|
|
101
87
|
// call orginal callback
|
package/dist/es/index.js
CHANGED
|
@@ -7,8 +7,6 @@ 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 locizeEditor from 'locize-editor'; // locize-editor is for old client
|
|
11
|
-
|
|
12
10
|
import { locizePlugin } from 'locize';
|
|
13
11
|
var i18next = i18nextify.i18next;
|
|
14
12
|
var enforce = {
|
|
@@ -25,9 +23,7 @@ var reloadEditorOptions = {
|
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
|
-
|
|
29
|
-
i18next.use(LocizeBackend).use(locizePlugin).use(locizeEditor); // locize-editor is for old client
|
|
30
|
-
|
|
26
|
+
i18next.use(LocizeBackend).use(locizePlugin);
|
|
31
27
|
i18next.on('editorSaved', function () {
|
|
32
28
|
i18nextify.forceRerender();
|
|
33
29
|
});
|
|
@@ -42,7 +38,7 @@ i18next.init = function () {
|
|
|
42
38
|
if (scriptEle) {
|
|
43
39
|
var config = {};
|
|
44
40
|
var backend = {};
|
|
45
|
-
var toRead = ['fallbackLng', 'saveMissing', 'debug', '
|
|
41
|
+
var toRead = ['fallbackLng', 'saveMissing', 'debug', 'autorun', 'ele', 'cleanIndent', 'cleanWhitespace', 'namespace', 'namespaceFromPath', 'load'];
|
|
46
42
|
var toReadAsArray = ['ignoreTags', 'ignoreIds', 'ignoreClasses', 'translateAttributes', 'mergeTags', 'inlineTags', 'ignoreInlineOn', 'ignoreCleanIndentFor', 'ns'];
|
|
47
43
|
var toReadBackend = ['projectId', 'apiKey', 'referenceLng', 'version', 'allowedAddOrUpdateHost'];
|
|
48
44
|
toRead.forEach(function (attr) {
|
|
@@ -73,16 +69,6 @@ i18next.init = function () {
|
|
|
73
69
|
options.backend = _objectSpread(_objectSpread({}, options.backend), backend);
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
if ( // locize-editor is for old client
|
|
77
|
-
options.reloadOnSave && (!options.editor || !options.editor.onEditorSaved)) options.editor = _objectSpread(_objectSpread({}, options.editor), reloadEditorOptions);
|
|
78
|
-
|
|
79
|
-
if (options.bindSavedMissing) {
|
|
80
|
-
// locize-editor is for old client
|
|
81
|
-
options.backend.onSaved = function (lng, ns) {
|
|
82
|
-
locizeEditor.handleSavedMissing(lng, ns);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
72
|
function handleI18nextInitialized(err, t) {
|
|
87
73
|
// ready now
|
|
88
74
|
// call orginal callback
|