feat(i18n): support plural and gender special forms

This commit is contained in:
vsavkin
2016-04-12 11:46:49 -07:00
committed by Victor Savkin
parent 7c9717bba8
commit 88b0a239c4
11 changed files with 278 additions and 9 deletions

View File

@ -6,6 +6,8 @@ import {
HtmlAttrAst,
HtmlTextAst,
HtmlCommentAst,
HtmlExpansionAst,
HtmlExpansionCaseAst,
htmlVisitAll
} from 'angular2/src/compiler/html_ast';
import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util';
@ -70,6 +72,19 @@ class _Humanizer implements HtmlAstVisitor {
return null;
}
visitExpansion(ast: HtmlExpansionAst, context: any): any {
var res = this._appendContext(ast, [HtmlExpansionAst, ast.switchValue, ast.type]);
this.result.push(res);
htmlVisitAll(this, ast.cases);
return null;
}
visitExpansionCase(ast: HtmlExpansionCaseAst, context: any): any {
var res = this._appendContext(ast, [HtmlExpansionCaseAst, ast.value]);
this.result.push(res);
return null;
}
private _appendContext(ast: HtmlAst, input: any[]): any[] {
if (!this.includeSourceSpan) return input;
input.push(ast.sourceSpan.toString());