Skip to content

Commit 741e9ce

Browse files
committed
fix: reflect correctly the translation key in Timestamp component
1 parent 579953c commit 741e9ce

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

docusaurus/docs/React/guides/date-time-formatting.mdx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,6 @@ Now we can apply custom configuration in all the translation JSON files. It coul
152152
}
153153
```
154154

155-
Besides overriding the formatting parameters above, we can customize the translation key via `timestampTranslationKey` prop in all of the above mentioned components (`DateSeparator`, `EventComponent`, `MessageTimestamp`).
156-
157-
```tsx
158-
import { MessageTimestampProps, MessageTimestamp } from 'stream-chat-react';
159-
160-
const CustomMessageTimestamp = (props: MessageTimestampProps) => (
161-
<MessageTimestamp {...props} timestampTranslationKey='customTimestampTranslationKey' />
162-
);
163-
```
164-
165155
##### Understanding the formatting syntax
166156

167157
Once the default prop values are nullified, we override the default formatting rules in the JSON translation value. We can take a look at an example of German translation for SystemMessage:

src/components/Message/Timestamp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function Timestamp(props: TimestampProps) {
3737
messageCreatedAt: normalizedTimestamp,
3838
t,
3939
tDateTimeParser,
40-
timestampTranslationKey: 'timestamp/Timestamp',
40+
timestampTranslationKey: 'timestamp/MessageTimestamp',
4141
}),
4242
[calendar, calendarFormats, format, formatDate, normalizedTimestamp, t, tDateTimeParser],
4343
);

0 commit comments

Comments
 (0)