Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
56920f14
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56920f14
编写于
3月 16, 2016
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #4305: Provide API to access the locale and ui language
上级
91f2bd1c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
38 deletion
+44
-38
src/vs/base/common/platform.ts
src/vs/base/common/platform.ts
+33
-2
src/vs/platform/workspace/common/workspace.ts
src/vs/platform/workspace/common/workspace.ts
+0
-2
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-1
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+0
-10
src/vs/workbench/electron-main/menus.ts
src/vs/workbench/electron-main/menus.ts
+4
-11
src/vs/workbench/node/extensionPoints.ts
src/vs/workbench/node/extensionPoints.ts
+5
-12
未找到文件。
src/vs/base/common/platform.ts
浏览文件 @
56920f14
...
@@ -12,15 +12,24 @@ let _isLinux = false;
...
@@ -12,15 +12,24 @@ let _isLinux = false;
let
_isNative
=
false
;
let
_isNative
=
false
;
let
_isWeb
=
false
;
let
_isWeb
=
false
;
let
_isQunit
=
false
;
let
_isQunit
=
false
;
let
_locale
=
undefined
;
let
_language
=
undefined
;
interface
NLSConfig
{
locale
:
string
;
availableLanguages
:
{
[
key
:
string
]:
string
;
};
}
interface
INodeProcess
{
interface
INodeProcess
{
platform
:
string
;
platform
:
string
;
env
:
{
[
key
:
string
]:
string
;
};
}
}
declare
let
process
:
INodeProcess
;
declare
let
process
:
INodeProcess
;
declare
let
global
:
any
;
declare
let
global
:
any
;
interface
INavigator
{
interface
INavigator
{
userAgent
:
string
;
userAgent
:
string
;
language
:
string
;
}
}
declare
let
navigator
:
INavigator
;
declare
let
navigator
:
INavigator
;
declare
let
self
:
any
;
declare
let
self
:
any
;
...
@@ -30,6 +39,17 @@ if (typeof process === 'object') {
...
@@ -30,6 +39,17 @@ if (typeof process === 'object') {
_isWindows
=
(
process
.
platform
===
'
win32
'
);
_isWindows
=
(
process
.
platform
===
'
win32
'
);
_isMacintosh
=
(
process
.
platform
===
'
darwin
'
);
_isMacintosh
=
(
process
.
platform
===
'
darwin
'
);
_isLinux
=
(
process
.
platform
===
'
linux
'
);
_isLinux
=
(
process
.
platform
===
'
linux
'
);
let
vscode_nls_config
=
process
.
env
[
'
VSCODE_NLS_CONFIG
'
];
if
(
vscode_nls_config
)
{
try
{
let
nlsConfig
:
NLSConfig
=
JSON
.
parse
(
vscode_nls_config
);
let
resolved
=
nlsConfig
.
availableLanguages
[
'
*
'
];
_locale
=
nlsConfig
.
locale
;
// VSCode's default language is 'en'
_language
=
resolved
?
resolved
:
'
en
'
;
}
catch
(
e
)
{
}
}
_isNative
=
true
;
_isNative
=
true
;
}
else
if
(
typeof
navigator
===
'
object
'
)
{
}
else
if
(
typeof
navigator
===
'
object
'
)
{
let
userAgent
=
navigator
.
userAgent
;
let
userAgent
=
navigator
.
userAgent
;
...
@@ -37,7 +57,8 @@ if (typeof process === 'object') {
...
@@ -37,7 +57,8 @@ if (typeof process === 'object') {
_isMacintosh
=
userAgent
.
indexOf
(
'
Macintosh
'
)
>=
0
;
_isMacintosh
=
userAgent
.
indexOf
(
'
Macintosh
'
)
>=
0
;
_isLinux
=
userAgent
.
indexOf
(
'
Linux
'
)
>=
0
;
_isLinux
=
userAgent
.
indexOf
(
'
Linux
'
)
>=
0
;
_isWeb
=
true
;
_isWeb
=
true
;
_locale
=
navigator
.
language
;
_language
=
_locale
;
_isQunit
=
!!
(
<
any
>
self
).
QUnit
;
_isQunit
=
!!
(
<
any
>
self
).
QUnit
;
}
}
...
@@ -67,6 +88,16 @@ export const isWeb = _isWeb;
...
@@ -67,6 +88,16 @@ export const isWeb = _isWeb;
export
const
isQunit
=
_isQunit
;
export
const
isQunit
=
_isQunit
;
export
const
platform
=
_platform
;
export
const
platform
=
_platform
;
/**
* The language used for the user interface.
*/
export
const
language
=
_language
;
/**
* The OS locale or the locale specified by --locale
*/
export
const
locale
=
_locale
;
export
interface
TimeoutToken
{
export
interface
TimeoutToken
{
}
}
...
...
src/vs/platform/workspace/common/workspace.ts
浏览文件 @
56920f14
...
@@ -85,8 +85,6 @@ export interface IConfiguration {
...
@@ -85,8 +85,6 @@ export interface IConfiguration {
}
}
export
interface
IEnvironment
{
export
interface
IEnvironment
{
language
:
string
;
appName
:
string
;
appName
:
string
;
appRoot
:
string
;
appRoot
:
string
;
isBuilt
:
boolean
;
isBuilt
:
boolean
;
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
56920f14
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
score
}
from
'
vs/editor/common/modes/languageSelector
'
;
import
{
score
}
from
'
vs/editor/common/modes/languageSelector
'
;
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
{
regExpLeadsToEndlessLoop
}
from
'
vs/base/common/strings
'
;
import
{
regExpLeadsToEndlessLoop
}
from
'
vs/base/common/strings
'
;
import
{
Remotable
,
IThreadService
}
from
'
vs/platform/thread/common/thread
'
;
import
{
Remotable
,
IThreadService
}
from
'
vs/platform/thread/common/thread
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
...
@@ -152,7 +153,7 @@ export class ExtHostAPIImplementation {
...
@@ -152,7 +153,7 @@ export class ExtHostAPIImplementation {
this
.
env
=
Object
.
freeze
({
this
.
env
=
Object
.
freeze
({
get
machineId
()
{
return
telemetryInfo
.
machineId
;
},
get
machineId
()
{
return
telemetryInfo
.
machineId
;
},
get
sessionId
()
{
return
telemetryInfo
.
sessionId
;
},
get
sessionId
()
{
return
telemetryInfo
.
sessionId
;
},
get
language
()
{
return
contextService
.
getConfiguration
().
env
.
language
;
}
get
language
()
{
return
Platform
.
language
;
}
});
});
telemetryService
.
getTelemetryInfo
().
then
(
info
=>
telemetryInfo
=
info
,
errors
.
onUnexpectedError
);
telemetryService
.
getTelemetryInfo
().
then
(
info
=>
telemetryInfo
=
info
,
errors
.
onUnexpectedError
);
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
56920f14
...
@@ -50,16 +50,6 @@ export function startup(environment: IMainEnvironment, globalSettings: IGlobalSe
...
@@ -50,16 +50,6 @@ export function startup(environment: IMainEnvironment, globalSettings: IGlobalSe
env
:
environment
env
:
environment
};
};
// Inherit navigator language
let
language
=
navigator
.
language
;
try
{
var
config
=
process
.
env
[
'
VSCODE_NLS_CONFIG
'
];
if
(
config
)
{
language
=
JSON
.
parse
(
config
).
locale
;
}
}
catch
(
e
)
{
}
environment
.
language
=
language
;
// Shell Options
// Shell Options
let
filesToOpen
=
environment
.
filesToOpen
&&
environment
.
filesToOpen
.
length
?
toInputs
(
environment
.
filesToOpen
)
:
null
;
let
filesToOpen
=
environment
.
filesToOpen
&&
environment
.
filesToOpen
.
length
?
toInputs
(
environment
.
filesToOpen
)
:
null
;
...
...
src/vs/workbench/electron-main/menus.ts
浏览文件 @
56920f14
...
@@ -591,18 +591,11 @@ export class VSCodeMenu {
...
@@ -591,18 +591,11 @@ export class VSCodeMenu {
env
.
product
.
reportIssueUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miReportIssues
'
,
"
Report &&Issues
"
)),
click
:
()
=>
openUrl
(
env
.
product
.
reportIssueUrl
,
'
openReportIssues
'
)
})
:
null
,
env
.
product
.
reportIssueUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miReportIssues
'
,
"
Report &&Issues
"
)),
click
:
()
=>
openUrl
(
env
.
product
.
reportIssueUrl
,
'
openReportIssues
'
)
})
:
null
,
(
env
.
product
.
twitterUrl
||
env
.
product
.
requestFeatureUrl
||
env
.
product
.
reportIssueUrl
)
?
__separator__
()
:
null
,
(
env
.
product
.
twitterUrl
||
env
.
product
.
requestFeatureUrl
||
env
.
product
.
reportIssueUrl
)
?
__separator__
()
:
null
,
env
.
product
.
licenseUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miLicense
'
,
"
&&View License
"
)),
click
:
()
=>
{
env
.
product
.
licenseUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miLicense
'
,
"
&&View License
"
)),
click
:
()
=>
{
let
nlsConfig
=
process
.
env
[
'
VSCODE_NLS_CONFIG
'
];
if
(
platform
.
language
)
{
if
(
nlsConfig
)
{
openUrl
(
`
${
env
.
product
.
licenseUrl
}
?lang=
${
platform
.
language
}
`
,
'
openLicenseUrl
'
);
try
{
}
else
{
let
languages
=
JSON
.
parse
(
nlsConfig
).
availableLanguages
;
openUrl
(
env
.
product
.
licenseUrl
,
'
openLicenseUrl
'
);
if
(
languages
&&
languages
[
'
*
'
])
{
openUrl
(
`
${
env
.
product
.
licenseUrl
}
?lang=
${
languages
[
'
*
'
]}
`
,
'
openLicenseUrl
'
);
return
;
}
}
catch
(
e
)
{
}
}
}
openUrl
(
env
.
product
.
licenseUrl
,
'
openLicenseUrl
'
);
}})
:
null
,
}})
:
null
,
env
.
product
.
privacyStatementUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miPrivacyStatement
'
,
"
&&Privacy Statement
"
)),
click
:
()
=>
openUrl
(
env
.
product
.
privacyStatementUrl
,
'
openPrivacyStatement
'
)
})
:
null
,
env
.
product
.
privacyStatementUrl
?
new
MenuItem
({
label
:
mnemonicLabel
(
nls
.
localize
(
'
miPrivacyStatement
'
,
"
&&Privacy Statement
"
)),
click
:
()
=>
openUrl
(
env
.
product
.
privacyStatementUrl
,
'
openPrivacyStatement
'
)
})
:
null
,
(
env
.
product
.
licenseUrl
||
env
.
product
.
privacyStatementUrl
)
?
__separator__
()
:
null
,
(
env
.
product
.
licenseUrl
||
env
.
product
.
privacyStatementUrl
)
?
__separator__
()
:
null
,
...
...
src/vs/workbench/node/extensionPoints.ts
浏览文件 @
56920f14
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
'
use strict
'
;
'
use strict
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
Platform
from
'
vs/base/common/platform
'
;
import
pfs
=
require
(
'
vs/base/node/pfs
'
);
import
pfs
=
require
(
'
vs/base/node/pfs
'
);
import
{
IExtensionDescription
,
IMessage
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtensionDescription
,
IMessage
}
from
'
vs/platform/extensions/common/extensions
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Severity
from
'
vs/base/common/severity
'
;
...
@@ -24,18 +25,10 @@ interface NlsConfiguration {
...
@@ -24,18 +25,10 @@ interface NlsConfiguration {
locale
:
string
;
locale
:
string
;
pseudo
:
boolean
;
pseudo
:
boolean
;
}
}
const
nlsConfig
=
function
():
NlsConfiguration
{
const
nlsConfig
:
NlsConfiguration
=
{
if
(
process
.
env
[
'
VSCODE_NLS_CONFIG
'
])
{
locale
:
Platform
.
locale
,
try
{
pseudo
:
Platform
.
locale
===
'
pseudo
'
return
JSON
.
parse
(
process
.
env
[
'
VSCODE_NLS_CONFIG
'
]);
};
}
catch
(
err
)
{
return
{
locale
:
undefined
,
pseudo
:
false
};
}
}
}();
export
class
MessagesCollector
{
export
class
MessagesCollector
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录