@@ -96,31 +96,39 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
9696 }
9797 }
9898
99+ private migrateToMarketplaceLanguagePack ( language : string ) : void {
100+ this . isLanguageInstalled ( language )
101+ . then ( installed => {
102+ if ( ! installed ) {
103+ this . getLanguagePackExtension ( language )
104+ . then ( extension => {
105+ if ( extension ) {
106+ this . notificationService . prompt ( Severity . Warning , localize ( 'install language pack' , "In the near future, VS Code will only support language packs in the form of Marketplace extensions. Please install the '{0}' extension in order to continue to use the currently configured language. " , extension . displayName || extension . displayName ) ,
107+ [
108+ { label : localize ( 'install' , "Install" ) , run : ( ) => this . installExtension ( extension ) } ,
109+ { label : localize ( 'more information' , "More Information..." ) , run : ( ) => window . open ( 'https://go.microsoft.com/fwlink/?linkid=872941' ) }
110+ ] ) ;
111+ }
112+ } ) ;
113+ }
114+ } ) ;
115+ }
116+
99117 private checkAndInstall ( ) : void {
100118 const language = platform . language ;
101119 const locale = platform . locale ;
120+ const languagePackSuggestionIgnoreList = < string [ ] > JSON . parse ( this . storageService . get ( 'extensionsAssistant/languagePackSuggestionIgnore' , StorageScope . GLOBAL , '[]' ) ) ;
121+
122+ if ( ! this . galleryService . isEnabled ( ) ) {
123+ return ;
124+ }
102125 if ( language !== 'en' && language !== 'en_us' ) {
103- this . isLanguageInstalled ( language )
104- . then ( installed => {
105- if ( ! installed ) {
106- this . getLanguagePackExtension ( language )
107- . then ( extension => {
108- if ( extension ) {
109- this . notificationService . prompt ( Severity . Warning , localize ( 'install language pack' , "In the near future, VS Code will only support language packs in the form of Marketplace extensions. Please install the '{0}' extension in order to continue to use the currently configured language. " , extension . displayName || extension . displayName ) ,
110- [
111- { label : localize ( 'install' , "Install" ) , run : ( ) => this . installExtension ( extension ) } ,
112- { label : localize ( 'more information' , "More Information..." ) , run : ( ) => window . open ( 'https://go.microsoft.com/fwlink/?linkid=872941' ) }
113- ] ) ;
114- }
115- } ) ;
116- }
117- } ) ;
126+ this . migrateToMarketplaceLanguagePack ( language ) ;
127+ return ;
128+ }
129+ if ( locale === 'en' || locale === 'en_us' ) {
118130 return ;
119131 }
120-
121- const languagePackSuggestionIgnoreList = < string [ ] > JSON . parse ( this . storageService . get
122- ( 'extensionsAssistant/languagePackSuggestionIgnore' , StorageScope . GLOBAL , '[]' ) ) ;
123-
124132 if ( language === locale || languagePackSuggestionIgnoreList . indexOf ( language ) > - 1 ) {
125133 return ;
126134 }
@@ -146,86 +154,78 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
146154 return ;
147155 }
148156
149- this . galleryService . getManifest ( extensionToFetchTranslationsFrom ) . then ( x => {
150- if ( ! x . contributes || ! x . contributes . localizations ) {
151- return ;
152- }
153- const locContribution = x . contributes . localizations . filter ( x => x . languageId . toLowerCase ( ) === locale ) [ 0 ] ;
154- if ( ! locContribution ) {
155- return ;
156- }
157-
158- const translations = {
159- ...minimumTranslatedStrings ,
160- ...( locContribution . minimalTranslations || { } )
161- } ;
157+ this . galleryService . getCoreTranslations ( extensionToFetchTranslationsFrom , locale )
158+ . then ( coreTranslation => {
159+ const translations = {
160+ ...minimumTranslatedStrings ,
161+ ...( coreTranslation ? coreTranslation [ 'vs/platform/node/minimalTranslations' ] : { } )
162+ } ;
163+ const logUserReaction = ( userReaction : string ) => {
164+ /* __GDPR__
165+ "languagePackSuggestion:popup" : {
166+ "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
167+ "language": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
168+ }
169+ */
170+ this . telemetryService . publicLog ( 'languagePackSuggestion:popup' , { userReaction, language } ) ;
171+ } ;
162172
163- const logUserReaction = ( userReaction : string ) => {
164- /* __GDPR__
165- "languagePackSuggestion:popup" : {
166- "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
167- "language": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
173+ const searchAction = {
174+ label : translations [ 'searchMarketplace' ] ,
175+ run : ( ) => {
176+ logUserReaction ( 'search' ) ;
177+ this . viewletService . openViewlet ( EXTENSIONS_VIEWLET_ID , true )
178+ . then ( viewlet => viewlet as IExtensionsViewlet )
179+ . then ( viewlet => {
180+ viewlet . search ( `tag:lp-${ locale } ` ) ;
181+ viewlet . focus ( ) ;
182+ } ) ;
168183 }
169- */
170- this . telemetryService . publicLog ( 'languagePackSuggestion:popup' , { userReaction, language } ) ;
171- } ;
172-
173- const searchAction = {
174- label : translations [ 'searchMarketplace' ] ,
175- run : ( ) => {
176- logUserReaction ( 'search' ) ;
177- this . viewletService . openViewlet ( EXTENSIONS_VIEWLET_ID , true )
178- . then ( viewlet => viewlet as IExtensionsViewlet )
179- . then ( viewlet => {
180- viewlet . search ( `tag:lp-${ locale } ` ) ;
181- viewlet . focus ( ) ;
182- } ) ;
183- }
184- } ;
184+ } ;
185185
186- const installAction = {
187- label : translations [ 'install' ] ,
188- run : ( ) => {
189- logUserReaction ( 'install' ) ;
190- this . installExtension ( extensionToInstall ) ;
191- }
192- } ;
186+ const installAction = {
187+ label : translations [ 'install' ] ,
188+ run : ( ) => {
189+ logUserReaction ( 'install' ) ;
190+ this . installExtension ( extensionToInstall ) ;
191+ }
192+ } ;
193193
194- const installAndRestartAction = {
195- label : translations [ 'installAndRestart' ] ,
196- run : ( ) => {
197- logUserReaction ( 'installAndRestart' ) ;
198- this . installExtension ( extensionToInstall ) . then ( ( ) => this . windowsService . relaunch ( { } ) ) ;
199- }
200- } ;
194+ const installAndRestartAction = {
195+ label : translations [ 'installAndRestart' ] ,
196+ run : ( ) => {
197+ logUserReaction ( 'installAndRestart' ) ;
198+ this . installExtension ( extensionToInstall ) . then ( ( ) => this . windowsService . relaunch ( { } ) ) ;
199+ }
200+ } ;
201201
202- const mainActions = extensionToInstall ? [ installAndRestartAction , installAction ] : [ searchAction ] ;
203- const promptMessage = translations [ extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions' ]
204- . replace ( '{0}' , locContribution . languageNameLocalized || locContribution . languageName || locale ) ;
202+ const mainActions = extensionToInstall ? [ installAndRestartAction , installAction ] : [ searchAction ] ;
203+ const promptMessage = translations [ extensionToInstall ? 'installAndRestartMessage' : 'showLanguagePackExtensions' ]
204+ . replace ( '{0}' , locale ) ;
205205
206- this . notificationService . prompt (
207- Severity . Info ,
208- promptMessage ,
209- [ ...mainActions ,
210- {
211- label : localize ( 'neverAgain' , "Don't Show Again" ) ,
212- isSecondary : true ,
213- run : ( ) => {
214- languagePackSuggestionIgnoreList . push ( language ) ;
215- this . storageService . store (
216- 'extensionsAssistant/languagePackSuggestionIgnore' ,
217- JSON . stringify ( languagePackSuggestionIgnoreList ) ,
218- StorageScope . GLOBAL
219- ) ;
220- logUserReaction ( 'neverShowAgain' ) ;
206+ this . notificationService . prompt (
207+ Severity . Info ,
208+ promptMessage ,
209+ [ ...mainActions ,
210+ {
211+ label : localize ( 'neverAgain' , "Don't Show Again" ) ,
212+ isSecondary : true ,
213+ run : ( ) => {
214+ languagePackSuggestionIgnoreList . push ( language ) ;
215+ this . storageService . store (
216+ 'extensionsAssistant/languagePackSuggestionIgnore' ,
217+ JSON . stringify ( languagePackSuggestionIgnoreList ) ,
218+ StorageScope . GLOBAL
219+ ) ;
220+ logUserReaction ( 'neverShowAgain' ) ;
221+ }
222+ } ] ,
223+ ( ) => {
224+ logUserReaction ( 'cancelled' ) ;
221225 }
222- } ] ,
223- ( ) => {
224- logUserReaction ( 'cancelled' ) ;
225- }
226- ) ;
226+ ) ;
227227
228- } ) ;
228+ } ) ;
229229 } ) ;
230230 } ) ;
231231
0 commit comments