locizify 5.0.5 → 5.2.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,15 @@
1
+ ### v5.2.0
2
+
3
+ - update i18next dependencies
4
+
5
+ ### v5.1.0
6
+
7
+ - update locize dependecy and expose editor functions turnOn/Off
8
+
9
+ ### v5.0.6
10
+
11
+ - update locize dependencies
12
+
1
13
  ### v5.0.5
2
14
 
3
15
  - update locize dependencies
@@ -120,7 +132,6 @@
120
132
  - update deps using `locize.app` instead of `locize.io`
121
133
  - remove bower
122
134
 
123
-
124
135
  ### v2.15.1
125
136
 
126
137
  - update deps
package/README.md CHANGED
@@ -16,7 +16,7 @@ Just drop the following line to your header to deliver your content in any langu
16
16
  apikey="[API_KEY]"
17
17
  referencelng="[LNG]"
18
18
  fallbacklng="[LNG]"
19
- src="https://unpkg.com/locizify@^5.0.3"
19
+ src="https://unpkg.com/locizify@^5.0.5"
20
20
  ></script>
21
21
  ```
22
22
 
@@ -36,7 +36,6 @@ Did you wait 5-10 seconds before refreshing the locize UI? It may take a couple
36
36
 
37
37
  Per default only `localhost` is allowed to send missing keys ([or update missing keys](https://www.i18next.com/overview/configuration-options#missing-keys)) (to avoid using this feature accidentally [in production](https://docs.locize.com/guides-tips-and-tricks/going-production)). If you're not using `localhost` during development you will have to set the `allowedAddOrUpdateHosts: ['your.domain.tld']`.
38
38
 
39
-
40
39
  ## Find more information
41
40
 
42
41
  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:
@@ -61,7 +60,7 @@ Add the script to your page:
61
60
  apikey="[API_KEY]"
62
61
  referencelng="[LNG]"
63
62
  fallbacklng="[LNG]"
64
- src="https://unpkg.com/locizify@^5.0.3"
63
+ src="https://unpkg.com/locizify@^5.0.5"
65
64
  ></script>
66
65
  </head>
67
66
  ...
@@ -93,7 +92,7 @@ Add the script to your page:
93
92
  apikey="[API_KEY]"
94
93
  referencelng="[LNG]"
95
94
  fallbacklng="[LNG]"
96
- src="https://unpkg.com/locizify@^5.0.3"
95
+ src="https://unpkg.com/locizify@^5.0.5"
97
96
 
98
97
  // optional
99
98
  version="[VERSION]"
@@ -117,7 +116,7 @@ Add the script to your page:
117
116
  <!DOCTYPE html>
118
117
  <html>
119
118
  <head>
120
- <script src="https://unpkg.com/locizify@^5.0.3"></script>
119
+ <script src="https://unpkg.com/locizify@^5.0.5"></script>
121
120
  <script>
122
121
  locizify.init({
123
122
  // required
@@ -214,10 +213,10 @@ locizify.getLanguages(function(err, lngs) {
214
213
 
215
214
  ```js
216
215
  const translation = locizify.init({
217
- autorun: false
216
+ autorun: false,
218
217
  });
219
218
 
220
- setTimeout(function() {
219
+ setTimeout(function () {
221
220
  translation.start();
222
221
  }, 1000);
223
222
  ```
@@ -298,7 +297,7 @@ Just add needed items to the specific array:
298
297
  locizify.init({
299
298
  ignoreTags: ['SCRIPT'], // need to be uppercased
300
299
  ignoreIds: ['ignoreMeId'],
301
- ignoreClasses: ['ignoreMeClass']
300
+ ignoreClasses: ['ignoreMeClass'],
302
301
  });
303
302
  ```
304
303
 
@@ -345,7 +344,7 @@ Default would be translation.
345
344
 
346
345
  ```js
347
346
  locizify.init({
348
- namespace: 'myNamespace'
347
+ namespace: 'myNamespace',
349
348
  });
350
349
  ```
351
350
 
@@ -353,7 +352,7 @@ locizify.init({
353
352
 
354
353
  ```js
355
354
  locizify.init({
356
- namespaceFromPath: true
355
+ namespaceFromPath: true,
357
356
  });
358
357
  ```
359
358
 
@@ -415,7 +414,8 @@ Per default the virtualdom implementation will use the extracted content as keys
415
414
  }
416
415
  ```
417
416
 
418
- In some situations you like to define an explicit key for that segment:
417
+ In some situations you like to define an explicit key for that segment.
418
+ The default key attribute is `i18next-key`, so just add that attribute to the html element to be used as own translation key and the html element value will be used as default value:
419
419
 
420
420
  ```js
421
421
  // <div i18next-key="myKey">This is my text.</div>
@@ -427,6 +427,8 @@ In some situations you like to define an explicit key for that segment:
427
427
  }
428
428
  ```
429
429
 
430
+ \*Do NOT replace your html content with a custom key. This will technically work, but your server side representation will be negatively influenced (SEO), because there will not be any nice content fallback. Search engines like google search will then show your custom i18n keys instead of your website content. **So better use the `i18next-key` attribute to achieve this!\***
431
+
430
432
  There are two init options to configure this further:
431
433
 
432
434
  ```js
@@ -434,7 +436,7 @@ locizify.init({
434
436
  // ...
435
437
 
436
438
  keyAttr: 'i18next-key', // node attribute to use as key
437
- ignoreWithoutKey: false // set to true to only extract/translate nodes having a key
439
+ ignoreWithoutKey: false, // set to true to only extract/translate nodes having a key
438
440
 
439
441
  // ...
440
442
  });
@@ -467,3 +469,14 @@ You will have to enforce flat JSON in your locize project (settings -> publish f
467
469
  ```js
468
470
  locizify.forceRerender();
469
471
  ```
472
+
473
+ ## access to locize script (locize InContext editor)
474
+
475
+ https://github.com/locize/locize
476
+
477
+ ```js
478
+ let isOff;
479
+
480
+ isOff = locizify.editor.turnOff(); // -> true
481
+ isOff = locizify.editor.turnOn(); // -> false
482
+ ```
@@ -120,7 +120,12 @@ _i18nextify["default"].getOptions = function (callback) {
120
120
 
121
121
  i18next.on('initialized', ready);
122
122
  }
123
- };
123
+ }; // add editor functions
124
+
124
125
 
126
+ _i18nextify["default"].editor = {
127
+ turnOn: _locize.turnOn,
128
+ turnOff: _locize.turnOff
129
+ };
125
130
  var _default = _i18nextify["default"];
126
131
  exports["default"] = _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 } from 'locize';
10
+ import { locizePlugin, turnOn, turnOff } from 'locize';
11
11
  var i18next = i18nextify.i18next;
12
12
  var enforce = {
13
13
  saveMissingTo: 'all'
@@ -107,6 +107,11 @@ i18nextify.getOptions = function (callback) {
107
107
 
108
108
  i18next.on('initialized', ready);
109
109
  }
110
- };
110
+ }; // add editor functions
111
+
111
112
 
113
+ i18nextify.editor = {
114
+ turnOn: turnOn,
115
+ turnOff: turnOff
116
+ };
112
117
  export default i18nextify;