@lingui/macro
Advanced tools
Comparing version 4.7.1 to 4.8.0-next.0
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import type { ReactNode, VFC, FC } from "react" | ||
import type { I18n, MessageDescriptor } from "@lingui/core" | ||
import type { TransRenderCallbackOrComponent } from "@lingui/react" | ||
import type { TransRenderCallbackOrComponent, I18nContext } from "@lingui/react" | ||
@@ -319,1 +319,34 @@ export type ChoiceOptions = { | ||
export const Select: VFC<SelectChoiceProps> | ||
export function _t(descriptor: MacroMessageDescriptor): string | ||
export function _t( | ||
literals: TemplateStringsArray, | ||
...placeholders: any[] | ||
): string | ||
/** | ||
* | ||
* Macro version of useLingui replaces _ function with `t` macro function which is bound to i18n passed from React.Context | ||
* | ||
* Returned `t` macro function has all the same signatures as global `t` | ||
* | ||
* @example | ||
* ``` | ||
* const { t } = useLingui(); | ||
* const message = t`Text`; | ||
* ``` | ||
* | ||
* @example | ||
* ``` | ||
* const { i18n, t } = useLingui(); | ||
* const locale = i18n.locale; | ||
* const message = t({ | ||
* id: "msg.hello", | ||
* comment: "Greetings at the homepage", | ||
* message: `Hello ${name}`, | ||
* }); | ||
* ``` | ||
*/ | ||
export function useLingui(): Omit<I18nContext, "_"> & { | ||
t: typeof _t | ||
} |
{ | ||
"name": "@lingui/macro", | ||
"version": "4.7.1", | ||
"version": "4.8.0-next.0", | ||
"description": "Macro for generating messages in ICU MessageFormat syntax", | ||
@@ -68,5 +68,5 @@ "main": "./dist/index.cjs", | ||
"@babel/types": "^7.20.7", | ||
"@lingui/conf": "4.7.1", | ||
"@lingui/core": "4.7.1", | ||
"@lingui/message-utils": "4.7.1" | ||
"@lingui/conf": "^4.8.0-next.0", | ||
"@lingui/core": "^4.8.0-next.0", | ||
"@lingui/message-utils": "^4.8.0-next.0" | ||
}, | ||
@@ -86,3 +86,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "49647102dbbd7046a2c318ba0525c1392e370076" | ||
"gitHead": "d085ac65d66ce6c2f866b703b6346e53ff0bf6b3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
118911
3338
1
+ Added@lingui/conf@4.10.1(transitive)
- Removed@lingui/conf@4.7.1(transitive)
- Removed@lingui/core@4.7.1(transitive)
- Removed@lingui/message-utils@4.7.1(transitive)
Updated@lingui/conf@^4.8.0-next.0
Updated@lingui/core@^4.8.0-next.0