Skip to content

Commit f9baefa

Browse files
committed
fix error messages
1 parent 2ae7535 commit f9baefa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/ls/api.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/microsoft/typescript-go/internal/astnav"
1010
"github.com/microsoft/typescript-go/internal/checker"
1111
"github.com/microsoft/typescript-go/internal/compiler"
12+
"github.com/microsoft/typescript-go/internal/locale"
1213
)
1314

1415
var (
@@ -78,6 +79,7 @@ type Diagnostic struct {
7879

7980
type diagnosticList struct {
8081
diagnostics []*Diagnostic
82+
locale locale.Locale
8183
}
8284

8385
func (d *diagnosticList) addDiagnostic(diagnostic *ast.Diagnostic, ls *LanguageService, shouldAdd bool) *Diagnostic {
@@ -102,7 +104,7 @@ func (d *diagnosticList) addDiagnostic(diagnostic *ast.Diagnostic, ls *LanguageS
102104
SourceLine: sourceLine,
103105
Code: diagnostic.Code(),
104106
Category: diagnostic.Category().Name(),
105-
Message: diagnostic.Message(),
107+
Message: diagnostic.Localize(d.locale),
106108
MessageChain: make([]*Diagnostic, 0, len(diagnostic.MessageChain())),
107109
RelatedInformation: make([]*Diagnostic, 0, len(diagnostic.RelatedInformation())),
108110
}
@@ -137,6 +139,7 @@ func (l *LanguageService) GetDiagnostics(ctx context.Context, fileNames []string
137139
}
138140
diagnosticList := &diagnosticList{
139141
diagnostics: make([]*Diagnostic, 0),
142+
locale: program.CommandLine().Locale(),
140143
}
141144
diagnostics := make([]*ast.Diagnostic, 0, len(sourceFiles))
142145
for _, sourceFile := range sourceFiles {

0 commit comments

Comments
 (0)