Skip to content

Commit f40b59b

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

File tree

10 files changed

+38
-14
lines changed

10 files changed

+38
-14
lines changed

.github/workflows/node.js.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
security-events: write
8787
strategy:
8888
matrix:
89-
node-version: [14.x]
89+
node-version: [18.x]
9090
steps:
9191
- name: Checkout repository
9292
uses: actions/checkout@v2
@@ -95,7 +95,7 @@ jobs:
9595
mkdir -p /home/runner/.npm
9696
continue-on-error: true
9797
- name: Use Node.js ${{ matrix.node-version }}
98-
uses: actions/setup-node@v2
98+
uses: actions/setup-node@v4
9999
with:
100100
node-version: ${{ matrix.node-version }}
101101
cache: 'npm'
@@ -111,6 +111,9 @@ jobs:
111111
codacy-analysis-cli:
112112
name: Codacy Analysis CLI
113113
runs-on: ubuntu-latest
114+
strategy:
115+
matrix:
116+
language: [ "JavaScript" ]
114117
steps:
115118
- name: Checkout code
116119
uses: actions/checkout@main
@@ -126,9 +129,10 @@ jobs:
126129
max-allowed-issues: 2147483647
127130
# Upload the SARIF file generated in the previous step
128131
- name: Upload SARIF results file
129-
uses: github/codeql-action/upload-sarif@main
132+
uses: github/codeql-action/upload-sarif@v3
130133
with:
131134
sarif_file: results.sarif
135+
category: codeql-${{ matrix.language }}
132136

133137
smoke-test:
134138
name: Smoke Test

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)