Skip to content

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

Merged
merged 3 commits into from
Nov 21, 2016
Merged

Conversation

zhengbli
Copy link
Contributor

Currently the server is always using English diagnostics messages. This PR adds the support to use messages in other locales.

Copy link
Contributor

@mhegazy mhegazy left a 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());
Copy link
Contributor

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.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 18, 2016

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 {
Copy link
Contributor

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);
Copy link
Contributor

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

@zhengbli
Copy link
Contributor Author

@vladima Sorry that was a mistake, updated.

@zhengbli zhengbli merged commit 110c3ac into microsoft:master Nov 21, 2016
@zhengbli zhengbli deleted the localeInServer branch November 21, 2016 18:30
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants