Skip to content

Commit 3aeb1a0

Browse files
committed
Add option to disable error logging for missing keys in localization.
1 parent 7061f16 commit 3aeb1a0

File tree

9 files changed

+31
-11
lines changed

9 files changed

+31
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ Package the client library
4747
npm pack
4848
```
4949

50-
The library will be packaged in the same directory (eg. singleton-i18n-js-core-sdk-server-0.5.7.tgz)
50+
The library will be packaged in the same directory (eg. singleton-i18n-js-core-sdk-server-0.5.9.tgz)
5151

5252
Import the library in your ES2015 application
5353

5454
```
5555
cd <root path of your app>
56-
npm install <path-to-location-of-library-in-previous-step/singleton-i18n-js-core-sdk-server-0.5.7.tgz>
56+
npm install <path-to-location-of-library-in-previous-step/singleton-i18n-js-core-sdk-server-0.5.9.tgz>
5757
```
5858

5959
Configure your main module file :

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.client.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@singleton-i18n/js-core-sdk",
3-
"version": "0.5.8",
3+
"version": "0.5.9",
44
"publishConfig": {
55
"registry": ""
66
},
@@ -53,6 +53,15 @@
5353
"webpack-cli": "^5.1.4"
5454
},
5555
"changelogHistory": [
56+
{
57+
"date": "01/27/26",
58+
"version": "0.5.9",
59+
"notes": [
60+
{
61+
"description": "Add option to disable error logging for missing keys in localization."
62+
}
63+
]
64+
},
5665
{
5766
"date": "11/15/24",
5867
"version": "0.5.8",

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@singleton-i18n/js-core-sdk-server",
3-
"version": "0.5.8",
3+
"version": "0.5.9",
44
"publishConfig": {
55
"registry": ""
66
},
@@ -53,6 +53,15 @@
5353
"webpack-cli": "^5.1.4"
5454
},
5555
"changelogHistory": [
56+
{
57+
"date": "01/27/26",
58+
"version": "0.5.9",
59+
"notes": [
60+
{
61+
"description": "Add option to disable error logging for missing keys in localization."
62+
}
63+
]
64+
},
5665
{
5766
"date": "11/15/24",
5867
"version": "0.5.8",

samples/client/js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- You can load the translation by two ways, either from the Singleton service or from your predefined sources. If you want to use custom sources you have to add them in the src/translations
1313
with the following format: translation_locale.json and uncomment the code in the src/i18n.utils.js on row 30. The src/translations/translation_zh.json is example.
1414
```
15-
"@singleton-i18n/js-core-sdk": "file:../../../singleton-i18n-js-core-sdk-0.5.7.tgz"
15+
"@singleton-i18n/js-core-sdk": "file:../../../singleton-i18n-js-core-sdk-0.5.9.tgz"
1616
```
1717

1818
## Install

samples/client/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"load-translation": "load-translation --directory `pwd`/src/sources --product CoreSDKClient --component ui --host http://localhost:8091 --version 1.0 --languages zh,en"
1111
},
1212
"dependencies": {
13-
"@singleton-i18n/js-core-sdk": "file:../../../singleton-i18n-js-core-sdk-0.5.8.tgz",
13+
"@singleton-i18n/js-core-sdk": "file:../../../singleton-i18n-js-core-sdk-0.5.9.tgz",
1414
"argparse": "^1.0.10",
1515
"axios": "^0.21.1",
1616
"typescript": "^4.4.4"

samples/server/express/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
- Build the Singleton [JS client library](https://github.com/vmware/singleton/tree/g11n-js-client). The JS client library's location is preconfigured in this sample app's package.json. Change as needed.
99
```
10-
"@singleton-i18n/js-core-sdk-server": "file:../../../singleton-i18n-js-core-sdk-server-0.5.7.tgz"
10+
"@singleton-i18n/js-core-sdk-server": "file:../../../singleton-i18n-js-core-sdk-server-0.5.9.tgz"
1111
```
1212

1313
## Install

samples/server/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"collect-source-bundle": "collect-source-bundle --source-dir `pwd`/i18n --product NodeSample --component NodeJS --host http://localhost:8091 --version 1.0"
99
},
1010
"dependencies": {
11-
"@singleton-i18n/js-core-sdk-server": "file:../../../singleton-i18n-js-core-sdk-server-0.5.8.tgz",
11+
"@singleton-i18n/js-core-sdk-server": "file:../../../singleton-i18n-js-core-sdk-server-0.5.9.tgz",
1212
"argparse": "^1.0.10",
1313
"axios": "^0.21.1",
1414
"express": "4.15.3",

src/services/l10n.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2021 VMware, Inc.
2+
* Copyright 2019-2026 VMware, Inc.
33
* SPDX-License-Identifier: EPL-2.0
44
*/
55
import { Store } from '../cache';
@@ -85,7 +85,9 @@ export class L10nService {
8585
if (this.sourceData && this.sourceData[key]) {
8686
return this.sourceData && this.sourceData[key];
8787
}
88-
this.logger.error('No English found for key: ' + key + ' in sourceBundle');
88+
if (typeof window !== "undefined" && typeof window.localStorage !== "undefined" && window.localStorage.getItem("enable_localization_debug") === "true") {
89+
this.logger.error('No English found for key: ' + key + ' in sourceBundle');
90+
}
8991
return key;
9092
}
9193
/**

0 commit comments

Comments
 (0)