Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fb4a49b0
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,发现更多精彩内容 >>
提交
fb4a49b0
编写于
6月 01, 2017
作者:
M
Michel Kaporin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Target only core languages for the stable build. Ref #27818
上级
ab692310
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
42 deletion
+38
-42
build/gulpfile.vscode.js
build/gulpfile.vscode.js
+7
-5
build/lib/i18n.js
build/lib/i18n.js
+12
-17
build/lib/i18n.ts
build/lib/i18n.ts
+11
-18
build/lib/optimize.js
build/lib/optimize.js
+2
-1
build/lib/optimize.ts
build/lib/optimize.ts
+6
-1
未找到文件。
build/gulpfile.vscode.js
浏览文件 @
fb4a49b0
...
...
@@ -84,6 +84,11 @@ const BUNDLED_FILE_HEADER = [
'
*--------------------------------------------------------*/
'
].
join
(
'
\n
'
);
var
languages
=
[
'
chs
'
,
'
cht
'
,
'
jpn
'
,
'
kor
'
,
'
deu
'
,
'
fra
'
,
'
esn
'
,
'
rus
'
,
'
ita
'
];
if
(
product
.
quality
!==
'
stable
'
)
{
languages
=
languages
.
concat
([
'
ptb
'
]);
// Add languages requested by the community to non-stable builds
}
gulp
.
task
(
'
clean-optimized-vscode
'
,
util
.
rimraf
(
'
out-vscode
'
));
gulp
.
task
(
'
optimize-vscode
'
,
[
'
clean-optimized-vscode
'
,
'
compile-build
'
,
'
compile-extensions-build
'
],
common
.
optimizeTask
({
entryPoints
:
vscodeEntryPoints
,
...
...
@@ -91,7 +96,8 @@ gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compil
resources
:
vscodeResources
,
loaderConfig
:
common
.
loaderConfig
(
nodeModules
),
header
:
BUNDLED_FILE_HEADER
,
out
:
'
out-vscode
'
out
:
'
out-vscode
'
,
languages
:
languages
}));
...
...
@@ -158,10 +164,6 @@ gulp.task('electron', ['clean-electron'], getElectron(process.arch));
gulp
.
task
(
'
electron-ia32
'
,
[
'
clean-electron
'
],
getElectron
(
'
ia32
'
));
gulp
.
task
(
'
electron-x64
'
,
[
'
clean-electron
'
],
getElectron
(
'
x64
'
));
var
languages
=
[
'
chs
'
,
'
cht
'
,
'
jpn
'
,
'
kor
'
,
'
deu
'
,
'
fra
'
,
'
esn
'
,
'
rus
'
,
'
ita
'
];
if
(
product
.
quality
!==
'
stable
'
)
{
languages
.
concat
([
'
ptb
'
]);
}
/**
* Compute checksums for some files.
...
...
build/lib/i18n.js
浏览文件 @
fb4a49b0
"
use strict
"
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
var
path
=
require
(
"
path
"
);
var
fs
=
require
(
"
fs
"
);
...
...
@@ -207,17 +207,6 @@ XLF.parse = function (xlfString) {
});
};
exports
.
XLF
=
XLF
;
var
vscodeLanguages
=
[
'
chs
'
,
'
cht
'
,
'
jpn
'
,
'
kor
'
,
'
deu
'
,
'
fra
'
,
'
esn
'
,
'
rus
'
,
'
ita
'
];
var
iso639_3_to_2
=
{
'
chs
'
:
'
zh-cn
'
,
'
cht
'
:
'
zh-tw
'
,
...
...
@@ -347,7 +336,7 @@ function escapeCharacters(value) {
}
return
result
.
join
(
''
);
}
function
processCoreBundleFormat
(
fileHeader
,
json
,
emitter
)
{
function
processCoreBundleFormat
(
fileHeader
,
languages
,
json
,
emitter
)
{
var
keysSection
=
json
.
keys
;
var
messageSection
=
json
.
messages
;
var
bundleSection
=
json
.
bundles
;
...
...
@@ -375,8 +364,14 @@ function processCoreBundleFormat(fileHeader, json, emitter) {
});
});
var
languageDirectory
=
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
i18n
'
);
var
languages
=
sortLanguages
(
fs
.
readdirSync
(
languageDirectory
).
filter
(
function
(
item
)
{
return
fs
.
statSync
(
path
.
join
(
languageDirectory
,
item
)).
isDirectory
();
}));
languages
.
forEach
(
function
(
language
)
{
var
languageDirs
;
if
(
languageDirs
)
{
languageDirs
=
sortLanguages
(
languages
);
}
else
{
languageDirs
=
sortLanguages
(
fs
.
readdirSync
(
languageDirectory
).
filter
(
function
(
item
)
{
return
fs
.
statSync
(
path
.
join
(
languageDirectory
,
item
)).
isDirectory
();
}));
}
languageDirs
.
forEach
(
function
(
language
)
{
if
(
!
language
.
iso639_2
)
{
return
;
}
...
...
@@ -448,7 +443,7 @@ function processCoreBundleFormat(fileHeader, json, emitter) {
var
value
=
statistics
[
key
];
log
(
key
+
"
has
"
+
value
+
"
untranslated strings.
"
);
});
vscodeLanguage
s
.
forEach
(
function
(
language
)
{
languageDir
s
.
forEach
(
function
(
language
)
{
var
iso639_2
=
iso639_3_to_2
[
language
];
if
(
!
iso639_2
)
{
log
(
"
\t
Couldn't find iso639 2 mapping for language
"
+
language
+
"
. Using default language instead.
"
);
...
...
@@ -473,7 +468,7 @@ function processNlsFiles(opts) {
this
.
emit
(
'
error
'
,
"
Failed to read component file:
"
+
file
.
relative
);
}
if
(
BundledFormat
.
is
(
json
))
{
processCoreBundleFormat
(
opts
.
fileHeader
,
json
,
this
);
processCoreBundleFormat
(
opts
.
fileHeader
,
opts
.
languages
,
json
,
this
);
}
}
this
.
emit
(
'
data
'
,
file
);
...
...
build/lib/i18n.ts
浏览文件 @
fb4a49b0
...
...
@@ -272,18 +272,6 @@ export class XLF {
};
}
const
vscodeLanguages
:
string
[]
=
[
'
chs
'
,
'
cht
'
,
'
jpn
'
,
'
kor
'
,
'
deu
'
,
'
fra
'
,
'
esn
'
,
'
rus
'
,
'
ita
'
];
const
iso639_3_to_2
:
Map
<
string
>
=
{
'
chs
'
:
'
zh-cn
'
,
'
cht
'
:
'
zh-tw
'
,
...
...
@@ -420,7 +408,7 @@ function escapeCharacters(value: string): string {
return
result
.
join
(
''
);
}
function
processCoreBundleFormat
(
fileHeader
:
string
,
json
:
BundledFormat
,
emitter
:
any
)
{
function
processCoreBundleFormat
(
fileHeader
:
string
,
languages
:
string
[],
json
:
BundledFormat
,
emitter
:
any
)
{
let
keysSection
=
json
.
keys
;
let
messageSection
=
json
.
messages
;
let
bundleSection
=
json
.
bundles
;
...
...
@@ -450,8 +438,13 @@ function processCoreBundleFormat(fileHeader: string, json: BundledFormat, emitte
});
let
languageDirectory
=
path
.
join
(
__dirname
,
'
..
'
,
'
..
'
,
'
i18n
'
);
let
languages
=
sortLanguages
(
fs
.
readdirSync
(
languageDirectory
).
filter
((
item
)
=>
fs
.
statSync
(
path
.
join
(
languageDirectory
,
item
)).
isDirectory
()));
languages
.
forEach
((
language
)
=>
{
let
languageDirs
;
if
(
languageDirs
)
{
languageDirs
=
sortLanguages
(
languages
);
}
else
{
languageDirs
=
sortLanguages
(
fs
.
readdirSync
(
languageDirectory
).
filter
((
item
)
=>
fs
.
statSync
(
path
.
join
(
languageDirectory
,
item
)).
isDirectory
()));
}
languageDirs
.
forEach
((
language
)
=>
{
if
(
!
language
.
iso639_2
)
{
return
;
}
...
...
@@ -523,7 +516,7 @@ function processCoreBundleFormat(fileHeader: string, json: BundledFormat, emitte
let
value
=
statistics
[
key
];
log
(
`
${
key
}
has
${
value
}
untranslated strings.`
);
});
vscodeLanguage
s
.
forEach
(
language
=>
{
languageDir
s
.
forEach
(
language
=>
{
let
iso639_2
=
iso639_3_to_2
[
language
];
if
(
!
iso639_2
)
{
log
(
`\tCouldn't find iso639 2 mapping for language
${
language
}
. Using default language instead.`
);
...
...
@@ -536,7 +529,7 @@ function processCoreBundleFormat(fileHeader: string, json: BundledFormat, emitte
});
}
export
function
processNlsFiles
(
opts
:
{
fileHeader
:
string
;
}):
ThroughStream
{
export
function
processNlsFiles
(
opts
:
{
fileHeader
:
string
;
languages
:
string
[]
}):
ThroughStream
{
return
through
(
function
(
file
:
File
)
{
let
fileName
=
path
.
basename
(
file
.
path
);
if
(
fileName
===
'
nls.metadata.json
'
)
{
...
...
@@ -547,7 +540,7 @@ export function processNlsFiles(opts: { fileHeader: string; }): ThroughStream {
this
.
emit
(
'
error
'
,
`Failed to read component file:
${
file
.
relative
}
`
);
}
if
(
BundledFormat
.
is
(
json
))
{
processCoreBundleFormat
(
opts
.
fileHeader
,
json
,
this
);
processCoreBundleFormat
(
opts
.
fileHeader
,
opts
.
languages
,
json
,
this
);
}
}
this
.
emit
(
'
data
'
,
file
);
...
...
build/lib/optimize.js
浏览文件 @
fb4a49b0
...
...
@@ -163,7 +163,8 @@ function optimizeTask(opts) {
includeContent
:
true
}))
.
pipe
(
i18n
.
processNlsFiles
({
fileHeader
:
bundledFileHeader
fileHeader
:
bundledFileHeader
,
languages
:
opts
.
languages
}))
.
pipe
(
gulp
.
dest
(
out
));
};
...
...
build/lib/optimize.ts
浏览文件 @
fb4a49b0
...
...
@@ -158,6 +158,10 @@ export interface IOptimizeTaskOpts {
* (out folder name)
*/
out
:
string
;
/**
* (languages to process)
*/
languages
:
string
[];
}
export
function
optimizeTask
(
opts
:
IOptimizeTaskOpts
):
()
=>
NodeJS
.
ReadWriteStream
{
const
entryPoints
=
opts
.
entryPoints
;
...
...
@@ -228,7 +232,8 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
includeContent
:
true
}))
.
pipe
(
i18n
.
processNlsFiles
({
fileHeader
:
bundledFileHeader
fileHeader
:
bundledFileHeader
,
languages
:
opts
.
languages
}))
.
pipe
(
gulp
.
dest
(
out
));
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录