Skip to content

Commit e608466

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

10 files changed

Lines changed: 48 additions & 27 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ jobs:
5757
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
5858
strategy:
5959
matrix:
60-
node-version: [14.x]
60+
node-version: [18.x]
6161
steps:
6262
- name: Checkout code
6363
uses: actions/checkout@v2
6464
- name: Use Node.js ${{ matrix.node-version }}
65-
uses: actions/setup-node@v2
65+
uses: actions/setup-node@v4
6666
with:
6767
node-version: ${{ matrix.node-version }}
6868
cache: 'npm'
@@ -86,34 +86,34 @@ 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
92-
uses: actions/checkout@v2
92+
uses: actions/checkout@v4
9393
- name: Create cache folder
9494
run: |
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'
102102
- name: Initialize CodeQL
103-
uses: github/codeql-action/init@v2
103+
uses: github/codeql-action/init@v3
104104
with:
105105
languages: javascript
106106
- name: Autobuild
107-
uses: github/codeql-action/autobuild@v2
107+
uses: github/codeql-action/autobuild@v3
108108
- name: Perform CodeQL Analysis
109-
uses: github/codeql-action/analyze@v2
109+
uses: github/codeql-action/analyze@v3
110110

111111
codacy-analysis-cli:
112112
name: Codacy Analysis CLI
113113
runs-on: ubuntu-latest
114114
steps:
115115
- name: Checkout code
116-
uses: actions/checkout@main
116+
uses: actions/checkout@v4
117117
- name: Run Codacy Analysis CLI
118118
uses: codacy/codacy-analysis-cli-action@master
119119
with:
@@ -125,10 +125,11 @@ jobs:
125125
# This will handover control about PR rejection to the GitHub side
126126
max-allowed-issues: 2147483647
127127
# Upload the SARIF file generated in the previous step
128-
- name: Upload SARIF results file
129-
uses: github/codeql-action/upload-sarif@main
130-
with:
131-
sarif_file: results.sarif
128+
# - name: Upload SARIF results file
129+
# uses: github/codeql-action/upload-sarif@v4
130+
# with:
131+
# sarif_file: results.sarif
132+
#category: codacy-javascript
132133

133134
smoke-test:
134135
name: Smoke Test
@@ -137,7 +138,7 @@ jobs:
137138
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
138139
strategy:
139140
matrix:
140-
node-version: [14.x]
141+
node-version: [18.x]
141142
steps:
142143
- name: Checkout code
143144
uses: actions/checkout@v2
@@ -147,7 +148,7 @@ jobs:
147148
distribution: 'adopt'
148149
java-version: '17'
149150
- name: Use Node.js ${{ matrix.node-version }}
150-
uses: actions/setup-node@v2
151+
uses: actions/setup-node@v4
151152
with:
152153
node-version: ${{ matrix.node-version }}
153154
cache: 'npm'
@@ -164,7 +165,7 @@ jobs:
164165
cp -a devops/autotest/client/jscoresdk/resources/bundles/JSCoreSDKTest service/g11n-ws/vip-manager-i18n/src/main/resources/l10n/bundles/
165166
cd $GITHUB_WORKSPACE/service/g11n-ws && ./gradlew build -x test
166167
cp $GITHUB_WORKSPACE/devops/deploy/i18n-service/Dockerfile $GITHUB_WORKSPACE/service/publish/
167-
cd $GITHUB_WORKSPACE/service/publish && mv singleton-[0-9\.]*.jar i18n-service.jar
168+
cd $GITHUB_WORKSPACE/service/publish && mv singleton-0.1.0.jar i18n-service.jar
168169
docker build -t singleton .
169170
docker run -d -p 8090:8090 -p 8091:8091 --name singleton singleton
170171
docker ps

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)