We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
i18n._(id) throws error if id param passed as undefined
i18n._(id)
To Reproduce
This is just an example.
import { i18n } from "@lingui/core" export default function ErrorComponent(errorMsg) { return ( <p>{i18n._(errorMsg) || <Trans>There is an error</Trans>}</p> ) }
Expected behavior
Additional context
It was working in v2.7.2
v2.7.2
typeof id === "object"
false
_( id: string | Object, values: Object = {}, { defaults, formats = {} }: MessageOptions = {} ) { // Expand message descriptor if (id && typeof id === "object") { values = id.values defaults = id.defaults formats = id.formats id = id.id }
in version > 3.0.0, this got changed.
3.0.0
!isString(id)
true
_(descriptor: MessageDescriptor): string _(id: string, values?: Values, options?: MessageOptions): string _( id: MessageDescriptor | string, values?: Values, options?: MessageOptions ): string { let message = options?.message if (!isString(id)) { values = id.values || values message = id.message id = id.id }
lingui --version
npm list @babel/core
@lingui/swc-plugin
babel-macro-plugin
.babelrc
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
i18n._(id)
throws error if id param passed as undefinedTo Reproduce
This is just an example.
Expected behavior
Additional context
It was working in
v2.7.2
typeof id === "object"
check - returnsfalse
, if id is undefined as expectedin version >
3.0.0
, this got changed.!isString(id)
check - returnstrue
,if id is undefined. so it further checks values and throws errorlingui --version
4.7.0npm list @babel/core
7.15.5@lingui/swc-plugin
babel-macro-plugin
.babelrc
) or framework you use (Create React App, NextJs, Vite)The text was updated successfully, but these errors were encountered: