2022-01-31 13:41:58 +11:00
|
|
|
import { MessageDescriptor } from '@lingui/core';
|
|
|
|
|
import { Trans as OriginalTrans } from '@lingui/macro';
|
2022-04-22 14:33:13 +01:00
|
|
|
import React from 'react';
|
2021-12-15 16:00:37 +00:00
|
|
|
|
2022-01-31 13:41:58 +11:00
|
|
|
export const Trans: typeof OriginalTrans = ({ id, children }) => {
|
|
|
|
|
return <>{children ?? id}</>;
|
2021-12-15 16:00:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Plural: React.FC = () => {
|
|
|
|
|
throw new Error('Plural mock not implemented yet');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Select: React.FC = () => {
|
|
|
|
|
throw new Error('Select mock not implemented yet');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const SelectOrdinal: React.FC = () => {
|
|
|
|
|
throw new Error('SelectOrdinal mock not implemented yet');
|
|
|
|
|
};
|
2022-01-17 16:58:49 +00:00
|
|
|
|
|
|
|
|
export const t = (msg: string | { message: string }) => {
|
|
|
|
|
return typeof msg === 'string' ? msg : msg.message;
|
|
|
|
|
};
|
2022-01-31 13:41:58 +11:00
|
|
|
|
|
|
|
|
export const defineMessage = (descriptor: MessageDescriptor) => {
|
|
|
|
|
// We return the message as the ID so we can assert on the plain english value
|
|
|
|
|
return { ...descriptor, id: descriptor.message };
|
|
|
|
|
};
|