@transifex/native 2.1.1 → 2.3.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/README.md +29 -1
- package/dist/browser.native.js +2 -2
- package/dist/browser.native.js.map +1 -1
- package/dist/node.native.d.ts +1 -0
- package/dist/node.native.js +2 -2
- package/dist/node.native.js.map +1 -1
- package/package.json +1 -1
- package/src/TxNative.js +97 -10
- package/src/cache/MemoryCache.js +4 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +10 -0
package/README.md
CHANGED
|
@@ -88,7 +88,6 @@ tx.init({
|
|
|
88
88
|
const message = t('Welcome {user}', {user: 'Joe'});
|
|
89
89
|
console.log(message);
|
|
90
90
|
});
|
|
91
|
-
}
|
|
92
91
|
</script>
|
|
93
92
|
```
|
|
94
93
|
|
|
@@ -267,6 +266,35 @@ offEvent(type, function)
|
|
|
267
266
|
sendEvent(type, payload, caller)
|
|
268
267
|
```
|
|
269
268
|
|
|
269
|
+
## Using more than one TX Native instances
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
const { tx, t, createNativeInstance } = require('@transifex/native');
|
|
273
|
+
|
|
274
|
+
// Initiatate a secondary TX Instance
|
|
275
|
+
const txOtherInstance = createNativeInstance();
|
|
276
|
+
txOtherInstance.init({
|
|
277
|
+
token: '<PUBLIC PROJECT TOKEN 2>',
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
// initialize SDK
|
|
281
|
+
tx.init({
|
|
282
|
+
token: '<PUBLIC PROJECT TOKEN>',
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
// Use tx as a controller of the other instance
|
|
286
|
+
tx.controllerOf(txOtherInstance);
|
|
287
|
+
|
|
288
|
+
// get all languages
|
|
289
|
+
tx.setCurrentLocale('fr').then(function() {
|
|
290
|
+
// translate something
|
|
291
|
+
const message = t('Welcome {user}', {user: 'Joe'});
|
|
292
|
+
console.log(message);
|
|
293
|
+
const message2 = txOtherInstance.t('Welcome {user}', {user: 'Joe'});
|
|
294
|
+
console.log(message2);
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
270
298
|
# License
|
|
271
299
|
|
|
272
300
|
Licensed under Apache License 2.0, see [LICENSE](https://github.com/transifex/transifex-javascript/blob/HEAD/LICENSE) file.
|