docs: migrate examples to v4#1674
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
| one: 'Developer', | ||
| other: `Developers` | ||
| })} | ||
| <Plural value={selected} one={'Developer'} other={`Developers`} /> |
There was a problem hiding this comment.
@yunsii whenever non-react macro (t, plural, select, etc) is used in react component, useLingui() hook should be added as well. OR just use JSX macro instead.
That caused a translation mismatch you noticed in the issue.
Here i've just changed it to JSX macro, because it's more appropriate usage.
There was a problem hiding this comment.
It means if i don't use i18n, should still call useLingui hook like below?
import { useLingui } from "@lingui/react"
import { plural } from '@lingui/macro'
function App() {
useLingui()
//...
return (
<p>
{plural(selected, {
one: 'Developer',
other: `Developers`
})}
</p>
)
}There was a problem hiding this comment.
yes. plural / t / select / selectOrdinal macro is simply a syntax sugar over i18n, it is expanded to the i18n._ call during build.
I recommend to use react-related macros whenever possible, because it auto subscribe for a changes and less error-prone.
There was a problem hiding this comment.
Theaks for your detail explanation 👌
| #. js-lingui-explicit-id | ||
| #: src/components/AboutText.tsx:6 | ||
| msgid "next-explanation" |
There was a problem hiding this comment.
@yunsii for explicit custom ids lingui@4 requires #. js-lingui-explicit-id comment to be added. This was a root cause why this section was not translated.
| "@lingui/core": "^4.1.2", | ||
| "@lingui/react": "^4.1.2", | ||
| "next": "13.2.3", | ||
| "next": "13.3.1", |
There was a problem hiding this comment.
The release version of @lingui/swc-plugin was built with a newer version of the swc-core, which is not compatible with next@13.2.3" this caused a "panic" during build. I put a compatible version and added a compatibility notice into readme.
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #1674 +/- ##
=======================================
Coverage 75.70% 75.70%
=======================================
Files 79 79
Lines 2033 2033
Branches 520 520
=======================================
Hits 1539 1539
Misses 379 379
Partials 115 115 ☔ View full report in Codecov by Sentry. |
|
@thekip thank you! |
Description
Some of examples get outdated after updating to v4. This PR migrates them to latest version.
#1673
Types of changes
Fixes # (issue)
Checklist