Skip to content

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

@mhegazymhegazy 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

also this will need to be ported to release-2.1

}

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}


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
ContributorAuthor

@vladima Sorry that was a mistake, updated.

@zhengblizhengbli merged commit 110c3ac into microsoft:masterNov 21, 2016
@zhengblizhengbli deleted the localeInServer branch November 21, 2016 18:30
@microsoftmicrosoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for freeto 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

@zhengbli@mhegazy@vladima@msftclas