You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/React/guides/theming/translations.mdx
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,6 +286,28 @@ const i18n = new Streami18n({
286
286
287
287
If you would like to stick with english language for dates and times in Stream components, you can set `disableDateTimeTranslations` to true.
288
288
289
+
### Timezone location
290
+
291
+
To display date and time in different than machine's local timezone, provide the `timezone` parameter to the `Streami18n` constructor. The `timezone` value has to be a [valid timezone identifier string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). If no `timezone` parameter is provided, then the machine's local timezone is applied.
If you are using `moment` as your datetime parser engine and want to start using timezone-located datetime strings, then we recommend to use `moment-timezone` instead of `moment` package. Moment Timezone will automatically load and extend the moment module, then return the modified instance. This will also prevent multiple versions of `moment` being installed in a project.
300
+
301
+
```ts
302
+
importtypemomentTimezonefrom'moment-timezone';
303
+
import { Streami18n } from'stream-chat-react';
304
+
305
+
consti18n=newStreami18n({
306
+
DateTimeParser: momentTimezone,
307
+
timezone: 'Europe/Prague',
308
+
})
309
+
```
310
+
289
311
### Translating Messages
290
312
291
313
Stream Chat provide the ability to run users' messages through automatic translation.
@@ -317,8 +339,7 @@ The `Streami18n` class wraps [`i18next`](https://www.npmjs.com/package/i18next)
0 commit comments