fix(ivy): i18n - do not generate jsdoc comments for $localize (#32473)

Previously the template compiler would generate the same jsdoc comment
block for `$localize` as for `goog.getMsg()`. But it turns out that
the closure compiler will complain if the `@desc` and `@meaning`
tags are used for non-`getMsg()` calls.

For now we do not generate the comments for `$localize` calls. They are
not being used at the moment.

In the future it would be good to be able to extract the descriptions and
meanings from the `$localize` calls rather than relying upon the `getMsg()`
calls, which we do now. So we need to find a workaround for this constraint.

PR Close #32473
This commit is contained in:
Pete Bacon Darwin
2019-09-04 15:11:25 +01:00
committed by Miško Hevery
parent 0187b3288b
commit a731119f9f
3 changed files with 11 additions and 70 deletions

View File

@ -25,7 +25,10 @@ export function createGoogleGetMsgStatements(
args.push(mapLiteral(params, true));
}
// /** Description and meaning of message */
// /**
// * @desc description of message
// * @meaning meaning of message
// */
// const MSG_... = goog.getMsg(..);
// I18N_X = MSG_...;
const statements = [];

View File

@ -17,10 +17,13 @@ export function createLocalizeStatements(
params: {[name: string]: o.Expression}): o.Statement[] {
const statements = [];
const jsdocComment = i18nMetaToDocStmt(metaFromI18nMessage(message));
if (jsdocComment !== null) {
statements.push(jsdocComment);
}
// TODO: re-enable these comments when we have a plan on how to make them work so that Closure
// compiler doesn't complain about the JSDOC comments.
// const jsdocComment = i18nMetaToDocStmt(metaFromI18nMessage(message));
// if (jsdocComment !== null) {
// statements.push(jsdocComment);
// }
const {messageParts, placeHolders} = serializeI18nMessageForLocalize(message);
statements.push(new o.ExpressionStatement(variable.set(