Skip to content

Localize Dynamic Forms with Lingui #1947

Closed Answered by timofei-iatsenko
Ahmed-Elbessfy asked this question in Q&A
Discussion options

You must be logged in to vote

https://lingui.dev/tutorials/react-patterns#lazy-translations

import {msg} from "@lingui/macro";
import {Trans} from "@lingui/react";

const defs = [
{
    category: "field",
    fieldType: "select",
    name: "Type",
    label: msg`Type`,
},
{
    category: "field",
    fieldType: "select",
     name: "subtype",
    label: msg`Subtype`,
},
]

// usage in jsx
<label>{label && <Trans id={label.id}/>}</label>;

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@Ahmed-Elbessfy
Comment options

Answer selected by Ahmed-Elbessfy
Comment options

You must be logged in to vote
6 replies
@Ahmed-Elbessfy
Comment options

@timofei-iatsenko
Comment options

@Ahmed-Elbessfy
Comment options

@timofei-iatsenko
Comment options

@Ahmed-Elbessfy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants