How to use the @lingui/macro.number function in @lingui/macro

To help you get started, we’ve selected a few @lingui/macro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / lingui__macro / lingui__macro-tests.tsx View on Github external
2: `${host} invites ${guest} and one other person to her party.`,
        other: `${host} invites ${guest} and # other people to her party.`
    }),
    male: 'male',
    other: 'other'
});

const selectIdResult = select('selectId', {
    value: gender,
    female: 'female',
    male: 'male',
    other: 'other'
});

const formattedDate: MessageDescriptor = date(new Date(), { timeZone: 'UTC' });
const formattedNumber: MessageDescriptor = number(1234.56, { style: 'currency', currency: 'EUR' });

// JSX
const App = () => {
    const name = 'Ken';
    const numBooks = 58;
    const gender = 'male';
    const price = 21.35;
    const lastLogin = new Date();
    const age = 23;
    return (
        <>
            Name {name} in <code>Trans</code>.
            Name {name} in <code>Trans</code> with <code>id</code>.

@lingui/macro

Macro for generating messages in ICU MessageFormat syntax

MIT
Latest version published 8 days ago

Package Health Score

98 / 100
Full package analysis