@lingui/macro
Advanced tools
Comparing version 3.12.1 to 3.13.0
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.EXTRACT_MARK = exports.COMMENT = exports.MESSAGE = exports.ID = void 0; | ||
exports.CONTEXT = exports.EXTRACT_MARK = exports.COMMENT = exports.MESSAGE = exports.ID = void 0; | ||
var ID = "id"; | ||
@@ -15,2 +15,4 @@ exports.ID = ID; | ||
var EXTRACT_MARK = "i18n"; | ||
exports.EXTRACT_MARK = EXTRACT_MARK; | ||
exports.EXTRACT_MARK = EXTRACT_MARK; | ||
var CONTEXT = "context"; | ||
exports.CONTEXT = CONTEXT; |
@@ -0,1 +1,2 @@ | ||
// @ts-ignore | ||
declare module "@lingui/macro" { | ||
@@ -2,0 +3,0 @@ import type { MessageDescriptor, I18n } from "@lingui/core" |
@@ -183,2 +183,3 @@ import type { ReactElement, ComponentType, ReactNode } from "react" | ||
values?: Record<string, unknown> | ||
context?: string | ||
component?: React.ComponentType<TransRenderProps> | ||
@@ -185,0 +186,0 @@ render?: (props: TransRenderProps) => ReactElement<any, any> | null |
@@ -84,3 +84,4 @@ "use strict"; | ||
id = _this$stripMacroAttri.id, | ||
comment = _this$stripMacroAttri.comment; | ||
comment = _this$stripMacroAttri.comment, | ||
context = _this$stripMacroAttri.context; | ||
@@ -107,2 +108,6 @@ if (!id && !message) { | ||
} | ||
} | ||
if (context) { | ||
attributes.push(_this.types.jsxAttribute(_this.types.jsxIdentifier(_constants.CONTEXT), _this.types.stringLiteral(context))); | ||
} // Parameters for variable substitution | ||
@@ -152,3 +157,4 @@ | ||
var comment = attributes.filter(_this.attrName([_constants.COMMENT]))[0]; | ||
var reserved = [_constants.ID, _constants.MESSAGE, _constants.COMMENT]; | ||
var context = attributes.filter(_this.attrName([_constants.CONTEXT]))[0]; | ||
var reserved = [_constants.ID, _constants.MESSAGE, _constants.COMMENT, _constants.CONTEXT]; | ||
@@ -164,2 +170,3 @@ if (_this.isI18nComponent(node)) {// no reserved prop names | ||
comment: maybeNodeValue(comment), | ||
context: maybeNodeValue(context), | ||
attributes: attributes.filter(_this.attrName(reserved, true)) | ||
@@ -232,3 +239,3 @@ }; | ||
var format = element.name.name.toLowerCase(); | ||
var props = element.attributes.filter(_this.attrName([_constants.ID, _constants.COMMENT, _constants.MESSAGE, "key", // we remove <Trans /> react props that are not useful for translation | ||
var props = element.attributes.filter(_this.attrName([_constants.ID, _constants.COMMENT, _constants.MESSAGE, _constants.CONTEXT, "key", // we remove <Trans /> react props that are not useful for translation | ||
"render", "component", "components"], true)); | ||
@@ -235,0 +242,0 @@ var token = { |
{ | ||
"name": "@lingui/macro", | ||
"version": "3.12.1", | ||
"version": "3.13.0", | ||
"description": "Macro for generating messages in ICU MessageFormat syntax", | ||
@@ -33,3 +33,3 @@ "main": "index.js", | ||
"@babel/runtime": "^7.11.2", | ||
"@lingui/conf": "^3.12.1", | ||
"@lingui/conf": "^3.13.0", | ||
"ramda": "^0.27.1" | ||
@@ -36,0 +36,0 @@ }, |
56257
1298
Updated@lingui/conf@^3.13.0