Skip to content

Commit 7be41e9

Browse files
Fix markdown settings localization (microsoft#180891)
The syntax backtick hash str hash backtick was getting mangled.... but it probably should be extracted out so translators don't have the potential for changing it.
1 parent 8243eb2 commit 7be41e9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/vs/workbench/services/themes/common/themeConfiguration.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const colorThemeSettingEnum: string[] = [];
2323
const colorThemeSettingEnumItemLabels: string[] = [];
2424
const colorThemeSettingEnumDescriptions: string[] = [];
2525

26+
function formatSettingAsLink(str: string) {
27+
return `\`#${str}#\``;
28+
}
29+
2630
const colorThemeSettingSchema: IConfigurationPropertySchema = {
2731
type: 'string',
2832
description: nls.localize('colorTheme', "Specifies the color theme used in the workbench."),
@@ -34,7 +38,7 @@ const colorThemeSettingSchema: IConfigurationPropertySchema = {
3438
};
3539
const preferredDarkThemeSettingSchema: IConfigurationPropertySchema = {
3640
type: 'string', //
37-
markdownDescription: nls.localize({ key: 'preferredDarkColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme for dark OS appearance when `#{0}#` is enabled.', ThemeSettings.DETECT_COLOR_SCHEME),
41+
markdownDescription: nls.localize({ key: 'preferredDarkColorTheme', comment: ['{0} will become a link to another setting.'] }, 'Specifies the preferred color theme for dark OS appearance when {0} is enabled.', formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)),
3842
default: ThemeSettingDefaults.COLOR_THEME_DARK,
3943
enum: colorThemeSettingEnum,
4044
enumDescriptions: colorThemeSettingEnumDescriptions,
@@ -43,7 +47,7 @@ const preferredDarkThemeSettingSchema: IConfigurationPropertySchema = {
4347
};
4448
const preferredLightThemeSettingSchema: IConfigurationPropertySchema = {
4549
type: 'string',
46-
markdownDescription: nls.localize({ key: 'preferredLightColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme for light OS appearance when `#{0}#` is enabled.', ThemeSettings.DETECT_COLOR_SCHEME),
50+
markdownDescription: nls.localize({ key: 'preferredLightColorTheme', comment: ['{0} will become a link to another setting.'] }, 'Specifies the preferred color theme for light OS appearance when {0} is enabled.', formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)),
4751
default: ThemeSettingDefaults.COLOR_THEME_LIGHT,
4852
enum: colorThemeSettingEnum,
4953
enumDescriptions: colorThemeSettingEnumDescriptions,
@@ -52,7 +56,7 @@ const preferredLightThemeSettingSchema: IConfigurationPropertySchema = {
5256
};
5357
const preferredHCDarkThemeSettingSchema: IConfigurationPropertySchema = {
5458
type: 'string',
55-
markdownDescription: nls.localize({ key: 'preferredHCDarkColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme used in high contrast dark mode when `#{0}#` is enabled.', ThemeSettings.DETECT_HC),
59+
markdownDescription: nls.localize({ key: 'preferredHCDarkColorTheme', comment: ['{0} will become a link to another setting.'] }, 'Specifies the preferred color theme used in high contrast dark mode when {0} is enabled.', formatSettingAsLink(ThemeSettings.DETECT_HC)),
5660
default: ThemeSettingDefaults.COLOR_THEME_HC_DARK,
5761
enum: colorThemeSettingEnum,
5862
enumDescriptions: colorThemeSettingEnumDescriptions,
@@ -61,7 +65,7 @@ const preferredHCDarkThemeSettingSchema: IConfigurationPropertySchema = {
6165
};
6266
const preferredHCLightThemeSettingSchema: IConfigurationPropertySchema = {
6367
type: 'string',
64-
markdownDescription: nls.localize({ key: 'preferredHCLightColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme used in high contrast light mode when `#{0}#` is enabled.', ThemeSettings.DETECT_HC),
68+
markdownDescription: nls.localize({ key: 'preferredHCLightColorTheme', comment: ['{0} will become a link to another setting.'] }, 'Specifies the preferred color theme used in high contrast light mode when {0} is enabled.', formatSettingAsLink(ThemeSettings.DETECT_HC)),
6569
default: ThemeSettingDefaults.COLOR_THEME_HC_LIGHT,
6670
enum: colorThemeSettingEnum,
6771
enumDescriptions: colorThemeSettingEnumDescriptions,
@@ -70,7 +74,7 @@ const preferredHCLightThemeSettingSchema: IConfigurationPropertySchema = {
7074
};
7175
const detectColorSchemeSettingSchema: IConfigurationPropertySchema = {
7276
type: 'boolean',
73-
markdownDescription: nls.localize({ key: 'detectColorScheme', comment: ['`#{0}#` and `#{1}#` will become a link to an other setting. Do not remove backtick or #'] }, 'If set, automatically switch to the preferred color theme based on the OS appearance. If the OS appearance is dark, the theme specified at `#{0}#` is used, for light `#{1}#`.', ThemeSettings.PREFERRED_DARK_THEME, ThemeSettings.PREFERRED_LIGHT_THEME),
77+
markdownDescription: nls.localize({ key: 'detectColorScheme', comment: ['{0} and {1} will become links to other settings.'] }, 'If set, automatically switch to the preferred color theme based on the OS appearance. If the OS appearance is dark, the theme specified at {0} is used, for light {1}.', formatSettingAsLink(ThemeSettings.PREFERRED_DARK_THEME), formatSettingAsLink(ThemeSettings.PREFERRED_LIGHT_THEME)),
7478
default: false
7579
};
7680

@@ -106,7 +110,7 @@ const productIconThemeSettingSchema: IConfigurationPropertySchema = {
106110
const detectHCSchemeSettingSchema: IConfigurationPropertySchema = {
107111
type: 'boolean',
108112
default: true,
109-
markdownDescription: nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. The high contrast theme to use is specified by `#{0}#` and `#{1}#`.", ThemeSettings.PREFERRED_HC_DARK_THEME, ThemeSettings.PREFERRED_HC_LIGHT_THEME),
113+
markdownDescription: nls.localize({ key: 'autoDetectHighContrast', comment: ['{0} and {1} will become links to other settings.'] }, "If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. The high contrast theme to use is specified by {0} and {1}", formatSettingAsLink(ThemeSettings.PREFERRED_HC_DARK_THEME), formatSettingAsLink(ThemeSettings.PREFERRED_HC_LIGHT_THEME)),
110114
scope: ConfigurationScope.APPLICATION
111115
};
112116

@@ -164,7 +168,7 @@ const tokenColorSchema: IJSONSchema = {
164168
semanticHighlighting: {
165169
description: nls.localize('editorColors.semanticHighlighting', 'Whether semantic highlighting should be enabled for this theme.'),
166170
deprecationMessage: nls.localize('editorColors.semanticHighlighting.deprecationMessage', 'Use `enabled` in `editor.semanticTokenColorCustomizations` setting instead.'),
167-
markdownDeprecationMessage: nls.localize('editorColors.semanticHighlighting.deprecationMessageMarkdown', 'Use `enabled` in `#editor.semanticTokenColorCustomizations#` setting instead.'),
171+
markdownDeprecationMessage: nls.localize({ key: 'editorColors.semanticHighlighting.deprecationMessageMarkdown', comment: ['{0} will become a link to another setting.'] }, 'Use `enabled` in {0} setting instead.', formatSettingAsLink('editor.semanticTokenColorCustomizations')),
168172
type: 'boolean'
169173
}
170174
},

0 commit comments

Comments
 (0)