Skip to content

Commit 02922cd

Browse files
authored
Use NLS strings for extension settings (#60)
The extension settings defined in the package.json can support translation if a package.nls.json is defined. VSCode determines the locale and looks up the appropriate strings. Signed-off-by: Eric Brown <[email protected]>
1 parent 2f31e1a commit 02922cd

File tree

4 files changed

+44
-28
lines changed

4 files changed

+44
-28
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"properties": {
8080
"bandit.args": {
8181
"default": [],
82-
"description": "Arguments passed in. Each argument is a separate item in the array.",
82+
"markdownDescription": "%settings.args.description%",
8383
"items": {
8484
"type": "string"
8585
},
@@ -88,13 +88,13 @@
8888
},
8989
"bandit.enabled": {
9090
"default": true,
91-
"markdownDescription": "Enable/disable linting Python files with Bandit.",
91+
"markdownDescription": "%settings.enabled.description%",
9292
"scope": "resource",
9393
"type": "boolean"
9494
},
9595
"bandit.path": {
9696
"default": [],
97-
"description": "When set to a path to bandit binary, extension will use that. NOTE: Using this option may slowdown server response time.",
97+
"markdownDescription": "%settings.path.description%",
9898
"scope": "resource",
9999
"items": {
100100
"type": "string"
@@ -103,21 +103,21 @@
103103
},
104104
"bandit.importStrategy": {
105105
"default": "useBundled",
106-
"description": "Defines where `bandit` is imported from. This setting may be ignored if `bandit.path` is set.",
106+
"markdownDescription": "%settings.importStrategy.description%",
107107
"enum": [
108108
"useBundled",
109109
"fromEnvironment"
110110
],
111111
"enumDescriptions": [
112-
"Always use the bundled version of `bandit`.",
113-
"Use `bandit` from environment, fallback to bundled version only if `bandit` not available in the environment."
112+
"%settings.importStrategy.useBundled.description%",
113+
"%settings.importStrategy.fromEnvironment.description%"
114114
],
115115
"scope": "window",
116116
"type": "string"
117117
},
118118
"bandit.interpreter": {
119119
"default": [],
120-
"description": "When set to a path to python executable, extension will use that to launch the server and any subprocess.",
120+
"markdownDescription": "%settings.interpreter.description%",
121121
"scope": "resource",
122122
"items": {
123123
"type": "string"
@@ -126,18 +126,18 @@
126126
},
127127
"bandit.showNotifications": {
128128
"default": "off",
129-
"description": "Controls when notifications are shown by this extension.",
129+
"markdownDescription": "%settings.showNotifications.description%",
130130
"enum": [
131131
"off",
132132
"onError",
133133
"onWarning",
134134
"always"
135135
],
136136
"enumDescriptions": [
137-
"All notifications are turned off, any errors or warning are still available in the logs.",
138-
"Notifications are shown only in the case of an error.",
139-
"Notifications are shown for errors and warnings.",
140-
"Notifications are show for anything that the server chooses to show."
137+
"%settings.showNotifications.off.description%",
138+
"%settings.showNotifications.onError.description%",
139+
"%settings.showNotifications.onWarning.description%",
140+
"%settings.showNotifications.always.description%"
141141
],
142142
"scope": "machine",
143143
"type": "string"
@@ -146,7 +146,7 @@
146146
},
147147
"commands": [
148148
{
149-
"title": "Restart Server",
149+
"title": "%command.restartServer%",
150150
"category": "Bandit",
151151
"command": "bandit.restart"
152152
}

package.nls.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"command.restartServer": "Restart Server",
3+
"extension.description": "Linting support for Python files using Pylint.",
4+
"settings.args.description": "Arguments passed in. Each argument is a separate item in the array.",
5+
"settings.enabled.description": "Enable/disable linting Python files with Bandit.",
6+
"settings.path.description": "When set to a path to bandit binary, extension will use that. NOTE: Using this option may slowdown server response time.",
7+
"settings.importStrategy.description": "Defines where `bandit` is imported from. This setting may be ignored if `bandit.path` is set.",
8+
"settings.importStrategy.useBundled.description": "Always use the bundled version of `bandit`.",
9+
"settings.importStrategy.fromEnvironment.description": "Use `bandit` from environment, fallback to bundled version only if `bandit` not available in the environment.",
10+
"settings.interpreter.description": "When set to a path to python executable, extension will use that to launch the server and any subprocess.",
11+
"settings.showNotifications.description": "Controls when notifications are shown by this extension.",
12+
"settings.showNotifications.off.description": "All notifications are turned off, any errors or warning are still available in the logs.",
13+
"settings.showNotifications.onError.description": "Notifications are shown only in the case of an error.",
14+
"settings.showNotifications.onWarning.description": "Notifications are shown for errors and warnings.",
15+
"settings.showNotifications.always.description": "Notifications are show for anything that the server chooses to show."
16+
}

requirements.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ bandit[sarif]==1.8.3 \
1616
--hash=sha256:28f04dc0d258e1dd0f99dee8eefa13d1cb5e3fde1a5ab0c523971f97b289bcd8 \
1717
--hash=sha256:f5847beb654d309422985c36644649924e0ea4425c76dec2e89110b87506193a
1818
# via -r ./requirements.in
19-
cattrs==24.1.2 \
20-
--hash=sha256:67c7495b760168d931a10233f979b28dc04daf853b30752246f4f8471c6d68d0 \
21-
--hash=sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85
19+
cattrs==24.1.3 \
20+
--hash=sha256:981a6ef05875b5bb0c7fb68885546186d306f10f0f6718fe9b96c226e68821ff \
21+
--hash=sha256:adf957dddd26840f27ffbd060a6c4dd3b2192c5b7c2c0525ef1bd8131d8a83f5
2222
# via
2323
# lsprotocol
2424
# pygls
@@ -30,9 +30,9 @@ jschema-to-python==1.2.3 \
3030
--hash=sha256:76ff14fe5d304708ccad1284e4b11f96a658949a31ee7faed9e0995279549b91 \
3131
--hash=sha256:8a703ca7604d42d74b2815eecf99a33359a8dccbb80806cce386d5e2dd992b05
3232
# via bandit
33-
jsonpickle==4.0.2 \
34-
--hash=sha256:3e650b9853adcdab9d9d62a88412b6d36e9a59ba423b01cacf0cd4ee80733aca \
35-
--hash=sha256:cd3c90d32a68dcaa7f0e4b918bda7d4bb61f3c03b182d82dae2caf9ded0ab6b3
33+
jsonpickle==4.0.5 \
34+
--hash=sha256:b4ac7d0a75ddcdfd93445737f1d36ff28768690d43e54bf5d0ddb1d915e580df \
35+
--hash=sha256:f299818b39367c361b3f26bdba827d4249ab5d383cd93144d0f94b5417aacb35
3636
# via jschema-to-python
3737
lsprotocol==2023.0.1 \
3838
--hash=sha256:c75223c9e4af2f24272b14c6375787438279369236cd568f596d4951052a60f2 \
@@ -120,9 +120,9 @@ pyyaml==6.0.2 \
120120
--hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \
121121
--hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4
122122
# via bandit
123-
rich==13.9.4 \
124-
--hash=sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098 \
125-
--hash=sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90
123+
rich==14.0.0 \
124+
--hash=sha256:1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0 \
125+
--hash=sha256:82f1bc23a6a21ebca4ae0c45af9bdbc492ed20231dcb63f297d6d1021a9d5725
126126
# via bandit
127127
sarif-om==1.0.4 \
128128
--hash=sha256:539ef47a662329b1c8502388ad92457425e95dc0aaaf995fe46f4984c4771911 \
@@ -132,9 +132,9 @@ stevedore==5.4.1 \
132132
--hash=sha256:3135b5ae50fe12816ef291baff420acb727fcd356106e3e9cbfa9e5985cd6f4b \
133133
--hash=sha256:d10a31c7b86cba16c1f6e8d15416955fc797052351a56af15e608ad20811fcfe
134134
# via bandit
135-
typing-extensions==4.12.2 \
136-
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
137-
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
135+
typing-extensions==4.13.0 \
136+
--hash=sha256:0a4ac55a5820789d87e297727d229866c9650f6521b64206413c4fbada24d95b \
137+
--hash=sha256:c8dd92cc0d6425a97c18fbb9d1954e5ff92c1ca881a309c45f06ebc0b79058e5
138138
# via
139139
# cattrs
140140
# rich

src/test/python_tests/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# pip-compile --generate-hashes ./src/test/python_tests/requirements.in
66
#
77
colorama==0.4.6 \
8-
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 \
9-
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44
10-
# via pytest
8+
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
9+
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
10+
# via -r ./src/test/python_tests/requirements.in
1111
exceptiongroup==1.2.2 \
1212
--hash=sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b \
1313
--hash=sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc

0 commit comments

Comments
 (0)