-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add locale options to tsserver #12369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make sys an argument passed in to the helpers. this way you avoid unexpected side-effects if some one uses it outside the server or tsc.
} | ||
|
||
export function trySetLanguageAndTerritory(language: string, territory: string, errors?: Diagnostic[]): boolean { | ||
const compilerFilePath = normalizePath(sys.getExecutingFilePath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sys and argument here.
also this will need to be ported to release-2.1 |
} | ||
|
||
return true; | ||
} | ||
|
||
export function trySetLanguageAndTerritory(language: string, territory: string, errors?: Diagnostic[]): boolean { | ||
export function trySetLanguageAndTerritory(language: string, territory: string, sys: System, errors?: Diagnostic[]): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not think you need the whole thing..
consider : host: {getExecutingFilePath():string, readFile(name:string):string; }
@@ -577,6 +577,11 @@ namespace ts.server { | |||
} | |||
} | |||
|
|||
const localeStr = findArgument("--locale"); | |||
if (localeStr && validateLocaleAndSetLanguage(localeStr, sys)) { | |||
validateLocaleAndSetLanguage(localeStr, sys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure that I get why do we need to call validateLocaleAndSetLanguage
twice
@vladima Sorry that was a mistake, updated. |
Currently the server is always using English diagnostics messages. This PR adds the support to use messages in other locales.