mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Localize refactor descriptions (#54379)
This commit is contained in:
parent
2f626bff03
commit
98ed0eb94c
@ -35,16 +35,16 @@ import {
|
||||
} from "../_namespaces/ts.refactor";
|
||||
|
||||
const refactorName = "Add or remove braces in an arrow function";
|
||||
const refactorDescription = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message;
|
||||
const refactorDescription = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
|
||||
|
||||
const addBracesAction = {
|
||||
name: "Add braces to arrow function",
|
||||
description: Diagnostics.Add_braces_to_arrow_function.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
|
||||
kind: "refactor.rewrite.arrow.braces.add",
|
||||
};
|
||||
const removeBracesAction = {
|
||||
name: "Remove braces from arrow function",
|
||||
description: Diagnostics.Remove_braces_from_arrow_function.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
|
||||
kind: "refactor.rewrite.arrow.braces.remove"
|
||||
};
|
||||
registerRefactor(refactorName, {
|
||||
|
||||
@ -61,12 +61,12 @@ const refactorName = "Convert export";
|
||||
|
||||
const defaultToNamedAction = {
|
||||
name: "Convert default export to named export",
|
||||
description: Diagnostics.Convert_default_export_to_named_export.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export),
|
||||
kind: "refactor.rewrite.export.named"
|
||||
};
|
||||
const namedToDefaultAction = {
|
||||
name: "Convert named export to default export",
|
||||
description: Diagnostics.Convert_named_export_to_default_export.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export),
|
||||
kind: "refactor.rewrite.export.default"
|
||||
};
|
||||
|
||||
@ -86,7 +86,7 @@ registerRefactor(refactorName, {
|
||||
|
||||
if (context.preferences.provideRefactorNotApplicableReason) {
|
||||
return [
|
||||
{ name: refactorName, description: Diagnostics.Convert_default_export_to_named_export.message, actions: [
|
||||
{ name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), actions: [
|
||||
{ ...defaultToNamedAction, notApplicableReason: info.error },
|
||||
{ ...namedToDefaultAction, notApplicableReason: info.error },
|
||||
]}
|
||||
|
||||
@ -55,17 +55,17 @@ const refactorName = "Convert import";
|
||||
const actions = {
|
||||
[ImportKind.Named]: {
|
||||
name: "Convert namespace import to named imports",
|
||||
description: Diagnostics.Convert_namespace_import_to_named_imports.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Convert_namespace_import_to_named_imports),
|
||||
kind: "refactor.rewrite.import.named",
|
||||
},
|
||||
[ImportKind.Namespace]: {
|
||||
name: "Convert named imports to namespace import",
|
||||
description: Diagnostics.Convert_named_imports_to_namespace_import.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_namespace_import),
|
||||
kind: "refactor.rewrite.import.namespace",
|
||||
},
|
||||
[ImportKind.Default]: {
|
||||
name: "Convert named imports to default import",
|
||||
description: Diagnostics.Convert_named_imports_to_default_import.message,
|
||||
description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_default_import),
|
||||
kind: "refactor.rewrite.import.default",
|
||||
},
|
||||
};
|
||||
|
||||
@ -12,6 +12,7 @@ import {
|
||||
factory,
|
||||
findAncestor,
|
||||
FunctionDeclaration,
|
||||
getLocaleSpecificMessage,
|
||||
getSourceFileOfNode,
|
||||
getSyntheticLeadingComments,
|
||||
getTokenAtPosition,
|
||||
@ -42,7 +43,7 @@ import {
|
||||
import { registerRefactor } from "../_namespaces/ts.refactor";
|
||||
|
||||
const refactorName = "Convert overload list to single signature";
|
||||
const refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message;
|
||||
const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
|
||||
|
||||
const functionOverloadAction = {
|
||||
name: refactorName,
|
||||
|
||||
@ -4,6 +4,7 @@ import {
|
||||
Debug,
|
||||
Diagnostics,
|
||||
emptyArray,
|
||||
getLocaleSpecificMessage,
|
||||
getRenameLocation,
|
||||
isIdentifier,
|
||||
isParameter,
|
||||
@ -15,7 +16,7 @@ import {
|
||||
} from "../_namespaces/ts.refactor";
|
||||
|
||||
const actionName = "Generate 'get' and 'set' accessors";
|
||||
const actionDescription = Diagnostics.Generate_get_and_set_accessors.message;
|
||||
const actionDescription = getLocaleSpecificMessage(Diagnostics.Generate_get_and_set_accessors);
|
||||
|
||||
const generateGetSetAction = {
|
||||
name: actionName,
|
||||
|
||||
@ -35,7 +35,7 @@ import {
|
||||
} from "../_namespaces/ts.refactor";
|
||||
|
||||
const refactorName = "Infer function return type";
|
||||
const refactorDescription = Diagnostics.Infer_function_return_type.message;
|
||||
const refactorDescription = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
|
||||
|
||||
const inferReturnTypeAction = {
|
||||
name: refactorName,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user