Skip to content

Commit e079d7c

Browse files
committed
b176d60 feat(i18n): implement a simple version of message extractor
1 parent 4641652 commit e079d7c

42 files changed

Lines changed: 1415 additions & 67 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD_INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Fri Mar 11 22:58:13 UTC 2016
2-
cb38d72ff4231c098c69fb3fa6dd3cbc634f0cbe
1+
Mon Mar 14 22:03:22 UTC 2016
2+
b176d6036d2a34898000b1d616181d545871b9c0

bundles/angular2-all-testing.umd.dev.js

Lines changed: 23 additions & 3 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.dev.js

Lines changed: 23 additions & 3 deletions
Large diffs are not rendered by default.

bundles/angular2-all.umd.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,6 +3648,12 @@ return /******/ (function(modules) { // webpackBootstrap
36483648
};
36493649
StringMapWrapper.set = function (map, key, value) { map[key] = value; };
36503650
StringMapWrapper.keys = function (map) { return Object.keys(map); };
3651+
StringMapWrapper.values = function (map) {
3652+
return Object.keys(map).reduce(function (r, a) {
3653+
r.push(map[a]);
3654+
return r;
3655+
}, []);
3656+
};
36513657
StringMapWrapper.isEmpty = function (map) {
36523658
for (var prop in map) {
36533659
return false;
@@ -26424,6 +26430,7 @@ return /******/ (function(modules) { // webpackBootstrap
2642426430
TemplateParseVisitor.prototype.visitAttr = function (ast, contex) {
2642526431
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2642626432
};
26433+
TemplateParseVisitor.prototype.visitComment = function (ast, context) { return null; };
2642726434
TemplateParseVisitor.prototype.visitElement = function (element, component) {
2642826435
var _this = this;
2642926436
var nodeName = element.name;
@@ -26806,6 +26813,7 @@ return /******/ (function(modules) { // webpackBootstrap
2680626813
var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);
2680726814
return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);
2680826815
};
26816+
NonBindableVisitor.prototype.visitComment = function (ast, context) { return null; };
2680926817
NonBindableVisitor.prototype.visitAttr = function (ast, context) {
2681026818
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2681126819
};
@@ -27015,9 +27023,11 @@ return /******/ (function(modules) { // webpackBootstrap
2701527023
this._consumeText(this._advance());
2701627024
this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);
2701727025
};
27018-
TreeBuilder.prototype._consumeComment = function (startToken) {
27019-
this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
27026+
TreeBuilder.prototype._consumeComment = function (token) {
27027+
var text = this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
2702027028
this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);
27029+
var value = lang_1.isPresent(text) ? text.parts[0].trim() : null;
27030+
this._addToParent(new html_ast_1.HtmlCommentAst(value, token.sourceSpan));
2702127031
};
2702227032
TreeBuilder.prototype._consumeText = function (token) {
2702327033
var text = token.parts[0];
@@ -27182,6 +27192,15 @@ return /******/ (function(modules) { // webpackBootstrap
2718227192
return HtmlElementAst;
2718327193
})();
2718427194
exports.HtmlElementAst = HtmlElementAst;
27195+
var HtmlCommentAst = (function () {
27196+
function HtmlCommentAst(value, sourceSpan) {
27197+
this.value = value;
27198+
this.sourceSpan = sourceSpan;
27199+
}
27200+
HtmlCommentAst.prototype.visit = function (visitor, context) { return visitor.visitComment(this, context); };
27201+
return HtmlCommentAst;
27202+
})();
27203+
exports.HtmlCommentAst = HtmlCommentAst;
2718527204
function htmlVisitAll(visitor, asts, context) {
2718627205
if (context === void 0) { context = null; }
2718727206
var result = [];
@@ -28468,6 +28487,7 @@ return /******/ (function(modules) { // webpackBootstrap
2846828487
}
2846928488
return null;
2847028489
};
28490+
TemplatePreparseVisitor.prototype.visitComment = function (ast, context) { return null; };
2847128491
TemplatePreparseVisitor.prototype.visitAttr = function (ast, context) { return null; };
2847228492
TemplatePreparseVisitor.prototype.visitText = function (ast, context) { return null; };
2847328493
return TemplatePreparseVisitor;

bundles/angular2-all.umd.min.js

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/angular2.dev.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@ System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"],
892892
StringMapWrapper.keys = function(map) {
893893
return Object.keys(map);
894894
};
895+
StringMapWrapper.values = function(map) {
896+
return Object.keys(map).reduce(function(r, a) {
897+
r.push(map[a]);
898+
return r;
899+
}, []);
900+
};
895901
StringMapWrapper.isEmpty = function(map) {
896902
for (var prop in map) {
897903
return false;
@@ -19696,6 +19702,17 @@ System.register("angular2/src/compiler/html_ast", ["angular2/src/facade/lang"],
1969619702
return HtmlElementAst;
1969719703
})();
1969819704
exports.HtmlElementAst = HtmlElementAst;
19705+
var HtmlCommentAst = (function() {
19706+
function HtmlCommentAst(value, sourceSpan) {
19707+
this.value = value;
19708+
this.sourceSpan = sourceSpan;
19709+
}
19710+
HtmlCommentAst.prototype.visit = function(visitor, context) {
19711+
return visitor.visitComment(this, context);
19712+
};
19713+
return HtmlCommentAst;
19714+
})();
19715+
exports.HtmlCommentAst = HtmlCommentAst;
1969919716
function htmlVisitAll(visitor, asts, context) {
1970019717
if (context === void 0) {
1970119718
context = null;
@@ -20445,6 +20462,9 @@ System.register("angular2/src/compiler/template_normalizer", ["angular2/src/comp
2044520462
}
2044620463
return null;
2044720464
};
20465+
TemplatePreparseVisitor.prototype.visitComment = function(ast, context) {
20466+
return null;
20467+
};
2044820468
TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) {
2044920469
return null;
2045020470
};
@@ -23468,9 +23488,11 @@ System.register("angular2/src/compiler/html_parser", ["angular2/src/facade/lang"
2346823488
this._consumeText(this._advance());
2346923489
this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);
2347023490
};
23471-
TreeBuilder.prototype._consumeComment = function(startToken) {
23472-
this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
23491+
TreeBuilder.prototype._consumeComment = function(token) {
23492+
var text = this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
2347323493
this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);
23494+
var value = lang_1.isPresent(text) ? text.parts[0].trim() : null;
23495+
this._addToParent(new html_ast_1.HtmlCommentAst(value, token.sourceSpan));
2347423496
};
2347523497
TreeBuilder.prototype._consumeText = function(token) {
2347623498
var text = token.parts[0];
@@ -24384,6 +24406,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2438424406
TemplateParseVisitor.prototype.visitAttr = function(ast, contex) {
2438524407
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2438624408
};
24409+
TemplateParseVisitor.prototype.visitComment = function(ast, context) {
24410+
return null;
24411+
};
2438724412
TemplateParseVisitor.prototype.visitElement = function(element, component) {
2438824413
var _this = this;
2438924414
var nodeName = element.name;
@@ -24731,6 +24756,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2473124756
var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);
2473224757
return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);
2473324758
};
24759+
NonBindableVisitor.prototype.visitComment = function(ast, context) {
24760+
return null;
24761+
};
2473424762
NonBindableVisitor.prototype.visitAttr = function(ast, context) {
2473524763
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2473624764
};

bundles/angular2.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@ System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"],
892892
StringMapWrapper.keys = function(map) {
893893
return Object.keys(map);
894894
};
895+
StringMapWrapper.values = function(map) {
896+
return Object.keys(map).reduce(function(r, a) {
897+
r.push(map[a]);
898+
return r;
899+
}, []);
900+
};
895901
StringMapWrapper.isEmpty = function(map) {
896902
for (var prop in map) {
897903
return false;
@@ -19696,6 +19702,17 @@ System.register("angular2/src/compiler/html_ast", ["angular2/src/facade/lang"],
1969619702
return HtmlElementAst;
1969719703
})();
1969819704
exports.HtmlElementAst = HtmlElementAst;
19705+
var HtmlCommentAst = (function() {
19706+
function HtmlCommentAst(value, sourceSpan) {
19707+
this.value = value;
19708+
this.sourceSpan = sourceSpan;
19709+
}
19710+
HtmlCommentAst.prototype.visit = function(visitor, context) {
19711+
return visitor.visitComment(this, context);
19712+
};
19713+
return HtmlCommentAst;
19714+
})();
19715+
exports.HtmlCommentAst = HtmlCommentAst;
1969919716
function htmlVisitAll(visitor, asts, context) {
1970019717
if (context === void 0) {
1970119718
context = null;
@@ -20445,6 +20462,9 @@ System.register("angular2/src/compiler/template_normalizer", ["angular2/src/comp
2044520462
}
2044620463
return null;
2044720464
};
20465+
TemplatePreparseVisitor.prototype.visitComment = function(ast, context) {
20466+
return null;
20467+
};
2044820468
TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) {
2044920469
return null;
2045020470
};
@@ -23468,9 +23488,11 @@ System.register("angular2/src/compiler/html_parser", ["angular2/src/facade/lang"
2346823488
this._consumeText(this._advance());
2346923489
this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);
2347023490
};
23471-
TreeBuilder.prototype._consumeComment = function(startToken) {
23472-
this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
23491+
TreeBuilder.prototype._consumeComment = function(token) {
23492+
var text = this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
2347323493
this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);
23494+
var value = lang_1.isPresent(text) ? text.parts[0].trim() : null;
23495+
this._addToParent(new html_ast_1.HtmlCommentAst(value, token.sourceSpan));
2347423496
};
2347523497
TreeBuilder.prototype._consumeText = function(token) {
2347623498
var text = token.parts[0];
@@ -24384,6 +24406,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2438424406
TemplateParseVisitor.prototype.visitAttr = function(ast, contex) {
2438524407
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2438624408
};
24409+
TemplateParseVisitor.prototype.visitComment = function(ast, context) {
24410+
return null;
24411+
};
2438724412
TemplateParseVisitor.prototype.visitElement = function(element, component) {
2438824413
var _this = this;
2438924414
var nodeName = element.name;
@@ -24731,6 +24756,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2473124756
var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);
2473224757
return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);
2473324758
};
24759+
NonBindableVisitor.prototype.visitComment = function(ast, context) {
24760+
return null;
24761+
};
2473424762
NonBindableVisitor.prototype.visitAttr = function(ast, context) {
2473524763
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2473624764
};

bundles/angular2.min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/web_worker/ui.dev.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,12 @@ System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"],
11391139
StringMapWrapper.keys = function(map) {
11401140
return Object.keys(map);
11411141
};
1142+
StringMapWrapper.values = function(map) {
1143+
return Object.keys(map).reduce(function(r, a) {
1144+
r.push(map[a]);
1145+
return r;
1146+
}, []);
1147+
};
11421148
StringMapWrapper.isEmpty = function(map) {
11431149
for (var prop in map) {
11441150
return false;
@@ -9960,6 +9966,17 @@ System.register("angular2/src/compiler/html_ast", ["angular2/src/facade/lang"],
99609966
return HtmlElementAst;
99619967
})();
99629968
exports.HtmlElementAst = HtmlElementAst;
9969+
var HtmlCommentAst = (function() {
9970+
function HtmlCommentAst(value, sourceSpan) {
9971+
this.value = value;
9972+
this.sourceSpan = sourceSpan;
9973+
}
9974+
HtmlCommentAst.prototype.visit = function(visitor, context) {
9975+
return visitor.visitComment(this, context);
9976+
};
9977+
return HtmlCommentAst;
9978+
})();
9979+
exports.HtmlCommentAst = HtmlCommentAst;
99639980
function htmlVisitAll(visitor, asts, context) {
99649981
if (context === void 0) {
99659982
context = null;
@@ -10709,6 +10726,9 @@ System.register("angular2/src/compiler/template_normalizer", ["angular2/src/comp
1070910726
}
1071010727
return null;
1071110728
};
10729+
TemplatePreparseVisitor.prototype.visitComment = function(ast, context) {
10730+
return null;
10731+
};
1071210732
TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) {
1071310733
return null;
1071410734
};
@@ -19018,9 +19038,11 @@ System.register("angular2/src/compiler/html_parser", ["angular2/src/facade/lang"
1901819038
this._consumeText(this._advance());
1901919039
this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);
1902019040
};
19021-
TreeBuilder.prototype._consumeComment = function(startToken) {
19022-
this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
19041+
TreeBuilder.prototype._consumeComment = function(token) {
19042+
var text = this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
1902319043
this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);
19044+
var value = lang_1.isPresent(text) ? text.parts[0].trim() : null;
19045+
this._addToParent(new html_ast_1.HtmlCommentAst(value, token.sourceSpan));
1902419046
};
1902519047
TreeBuilder.prototype._consumeText = function(token) {
1902619048
var text = token.parts[0];
@@ -20855,6 +20877,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2085520877
TemplateParseVisitor.prototype.visitAttr = function(ast, contex) {
2085620878
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2085720879
};
20880+
TemplateParseVisitor.prototype.visitComment = function(ast, context) {
20881+
return null;
20882+
};
2085820883
TemplateParseVisitor.prototype.visitElement = function(element, component) {
2085920884
var _this = this;
2086020885
var nodeName = element.name;
@@ -21202,6 +21227,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
2120221227
var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);
2120321228
return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);
2120421229
};
21230+
NonBindableVisitor.prototype.visitComment = function(ast, context) {
21231+
return null;
21232+
};
2120521233
NonBindableVisitor.prototype.visitAttr = function(ast, context) {
2120621234
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
2120721235
};

bundles/web_worker/worker.dev.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,12 @@ System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"],
13561356
StringMapWrapper.keys = function(map) {
13571357
return Object.keys(map);
13581358
};
1359+
StringMapWrapper.values = function(map) {
1360+
return Object.keys(map).reduce(function(r, a) {
1361+
r.push(map[a]);
1362+
return r;
1363+
}, []);
1364+
};
13591365
StringMapWrapper.isEmpty = function(map) {
13601366
for (var prop in map) {
13611367
return false;
@@ -19337,6 +19343,17 @@ System.register("angular2/src/compiler/html_ast", ["angular2/src/facade/lang"],
1933719343
return HtmlElementAst;
1933819344
})();
1933919345
exports.HtmlElementAst = HtmlElementAst;
19346+
var HtmlCommentAst = (function() {
19347+
function HtmlCommentAst(value, sourceSpan) {
19348+
this.value = value;
19349+
this.sourceSpan = sourceSpan;
19350+
}
19351+
HtmlCommentAst.prototype.visit = function(visitor, context) {
19352+
return visitor.visitComment(this, context);
19353+
};
19354+
return HtmlCommentAst;
19355+
})();
19356+
exports.HtmlCommentAst = HtmlCommentAst;
1934019357
function htmlVisitAll(visitor, asts, context) {
1934119358
if (context === void 0) {
1934219359
context = null;
@@ -20086,6 +20103,9 @@ System.register("angular2/src/compiler/template_normalizer", ["angular2/src/comp
2008620103
}
2008720104
return null;
2008820105
};
20106+
TemplatePreparseVisitor.prototype.visitComment = function(ast, context) {
20107+
return null;
20108+
};
2008920109
TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) {
2009020110
return null;
2009120111
};
@@ -30334,9 +30354,11 @@ System.register("angular2/src/compiler/html_parser", ["angular2/src/facade/lang"
3033430354
this._consumeText(this._advance());
3033530355
this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);
3033630356
};
30337-
TreeBuilder.prototype._consumeComment = function(startToken) {
30338-
this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
30357+
TreeBuilder.prototype._consumeComment = function(token) {
30358+
var text = this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);
3033930359
this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);
30360+
var value = lang_1.isPresent(text) ? text.parts[0].trim() : null;
30361+
this._addToParent(new html_ast_1.HtmlCommentAst(value, token.sourceSpan));
3034030362
};
3034130363
TreeBuilder.prototype._consumeText = function(token) {
3034230364
var text = token.parts[0];
@@ -34252,6 +34274,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
3425234274
TemplateParseVisitor.prototype.visitAttr = function(ast, contex) {
3425334275
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
3425434276
};
34277+
TemplateParseVisitor.prototype.visitComment = function(ast, context) {
34278+
return null;
34279+
};
3425534280
TemplateParseVisitor.prototype.visitElement = function(element, component) {
3425634281
var _this = this;
3425734282
var nodeName = element.name;
@@ -34599,6 +34624,9 @@ System.register("angular2/src/compiler/template_parser", ["angular2/src/facade/c
3459934624
var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);
3460034625
return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);
3460134626
};
34627+
NonBindableVisitor.prototype.visitComment = function(ast, context) {
34628+
return null;
34629+
};
3460234630
NonBindableVisitor.prototype.visitAttr = function(ast, context) {
3460334631
return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);
3460434632
};

0 commit comments

Comments
 (0)