stream-chat-react-native-core 10.0.0-rc.5 → 10.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +8 -5
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/commonjs/components/Poll/Poll.js +5 -2
- package/lib/commonjs/components/Poll/Poll.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +4 -2
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollOption.js +8 -3
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +5 -2
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +3 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResults.js +4 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResults.js.map +1 -1
- package/lib/commonjs/components/Poll/hooks/usePollState.js +3 -0
- package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/commonjs/components/Poll/hooks/usePollTextTranslation.js +17 -0
- package/lib/commonjs/components/Poll/hooks/usePollTextTranslation.js.map +1 -0
- package/lib/commonjs/components/Poll/index.js +11 -0
- package/lib/commonjs/components/Poll/index.js.map +1 -1
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js +9 -4
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/commonjs/hooks/useTranslatedMessage.js +4 -3
- package/lib/commonjs/hooks/useTranslatedMessage.js.map +1 -1
- package/lib/commonjs/store/SqliteClient.js +1 -1
- package/lib/commonjs/store/mappers/mapPollToStorable.js +4 -0
- package/lib/commonjs/store/mappers/mapPollToStorable.js.map +1 -1
- package/lib/commonjs/store/mappers/mapStorableToPoll.js +5 -1
- package/lib/commonjs/store/mappers/mapStorableToPoll.js.map +1 -1
- package/lib/commonjs/store/schema.js +2 -0
- package/lib/commonjs/store/schema.js.map +1 -1
- package/lib/commonjs/utils/i18n/getTranslatedText.js +7 -0
- package/lib/commonjs/utils/i18n/getTranslatedText.js.map +1 -0
- package/lib/commonjs/utils/utils.js +35 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +8 -5
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/module/components/Poll/Poll.js +5 -2
- package/lib/module/components/Poll/Poll.js.map +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js +4 -2
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/module/components/Poll/components/PollOption.js +8 -3
- package/lib/module/components/Poll/components/PollOption.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +5 -2
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js +3 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResults.js +4 -1
- package/lib/module/components/Poll/components/PollResults/PollResults.js.map +1 -1
- package/lib/module/components/Poll/hooks/usePollState.js +3 -0
- package/lib/module/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/module/components/Poll/hooks/usePollTextTranslation.js +17 -0
- package/lib/module/components/Poll/hooks/usePollTextTranslation.js.map +1 -0
- package/lib/module/components/Poll/index.js +11 -0
- package/lib/module/components/Poll/index.js.map +1 -1
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js +9 -4
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/module/hooks/useTranslatedMessage.js +4 -3
- package/lib/module/hooks/useTranslatedMessage.js.map +1 -1
- package/lib/module/store/SqliteClient.js +1 -1
- package/lib/module/store/mappers/mapPollToStorable.js +4 -0
- package/lib/module/store/mappers/mapPollToStorable.js.map +1 -1
- package/lib/module/store/mappers/mapStorableToPoll.js +5 -1
- package/lib/module/store/mappers/mapStorableToPoll.js.map +1 -1
- package/lib/module/store/schema.js +2 -0
- package/lib/module/store/schema.js.map +1 -1
- package/lib/module/utils/i18n/getTranslatedText.js +7 -0
- package/lib/module/utils/i18n/getTranslatedText.js.map +1 -0
- package/lib/module/utils/utils.js +35 -1
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewPollLabel.d.ts.map +1 -1
- package/lib/typescript/components/Poll/Poll.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollOptionFullResults.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollResults.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts +1 -0
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollTextTranslation.d.ts +7 -0
- package/lib/typescript/components/Poll/hooks/usePollTextTranslation.d.ts.map +1 -0
- package/lib/typescript/components/Poll/index.d.ts +1 -0
- package/lib/typescript/components/Poll/index.d.ts.map +1 -1
- package/lib/typescript/hooks/messagePreview/useMessagePreviewText.d.ts.map +1 -1
- package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapPollToStorable.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapStorableToPoll.d.ts.map +1 -1
- package/lib/typescript/store/schema.d.ts +2 -0
- package/lib/typescript/store/schema.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/getTranslatedText.d.ts +8 -0
- package/lib/typescript/utils/i18n/getTranslatedText.d.ts.map +1 -0
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewPollLabel.test.tsx +28 -3
- package/src/components/ChannelPreview/hooks/useChannelPreviewPollLabel.ts +8 -4
- package/src/components/Poll/Poll.tsx +4 -2
- package/src/components/Poll/__tests__/PollTranslation.test.tsx +152 -0
- package/src/components/Poll/components/PollAnswersList.tsx +5 -1
- package/src/components/Poll/components/PollOption.tsx +8 -4
- package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +5 -2
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +3 -1
- package/src/components/Poll/components/PollResults/PollResults.tsx +4 -2
- package/src/components/Poll/hooks/usePollState.ts +4 -0
- package/src/components/Poll/hooks/usePollTextTranslation.ts +19 -0
- package/src/components/Poll/index.ts +1 -0
- package/src/hooks/__tests__/useTranslatedMessage.test.tsx +20 -0
- package/src/hooks/messagePreview/__tests__/useMessagePreviewText.test.tsx +37 -2
- package/src/hooks/messagePreview/useMessagePreviewText.tsx +5 -2
- package/src/hooks/useTranslatedMessage.ts +6 -11
- package/src/store/SqliteClient.ts +1 -1
- package/src/store/apis/__tests__/pollTranslations.test.ts +136 -0
- package/src/store/mappers/mapPollToStorable.ts +6 -0
- package/src/store/mappers/mapStorableToPoll.ts +4 -0
- package/src/store/schema.ts +4 -0
- package/src/utils/__tests__/utils.test.ts +42 -1
- package/src/utils/i18n/__tests__/getTranslatedText.test.ts +17 -0
- package/src/utils/i18n/getTranslatedText.ts +10 -0
- package/src/utils/utils.ts +57 -1
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPollToStorable.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapPollToStorable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,iBAAiB,GAAI,MAAM,gBAAgB,KAAG,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"mapPollToStorable.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapPollToStorable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,iBAAiB,GAAI,MAAM,gBAAgB,KAAG,QAAQ,CAAC,MAAM,CAoDzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapStorableToPoll.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapStorableToPoll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,iBAAiB,GAAI,SAAS,QAAQ,CAAC,MAAM,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"mapStorableToPoll.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapStorableToPoll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,iBAAiB,GAAI,SAAS,QAAQ,CAAC,MAAM,CAAC,KAAG,gBAqD7D,CAAC"}
|
|
@@ -138,7 +138,9 @@ export type Schema = {
|
|
|
138
138
|
allow_answers?: boolean;
|
|
139
139
|
allow_user_suggested_options?: boolean;
|
|
140
140
|
description?: string;
|
|
141
|
+
description_i18n?: string;
|
|
141
142
|
is_closed?: boolean;
|
|
143
|
+
name_i18n?: string;
|
|
142
144
|
own_votes?: string;
|
|
143
145
|
voting_visibility?: string;
|
|
144
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/store/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,KAAK,MAAM,GAAG;KACX,CAAC,IAAI,MAAM,MAAM,GAAG;QACnB,OAAO,EAAE;aACN,CAAC,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM;SAC/B,CAAC;QACF,WAAW,CAAC,EAAE,KAAK,CAAC;YAClB,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9C,cAAc,EAAE,GAAG,MAAM,MAAM,EAAE,CAAC;YAClC,oBAAoB,EAAE,MAAM,CAAC;YAE7B,cAAc,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC;SACpF,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,KAAK,CAAC;YACd,OAAO,EAAE,KAAK,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,OAAO,CAAC;SACjB,CAAC,CAAC;QACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC;CACF,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/store/schema.ts"],"names":[],"mappings":"A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,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC;IACF,cAAc,EAAE;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the translation of a text into `language`, or undefined if there is none.
|
|
3
|
+
*
|
|
4
|
+
* The UI language can be any registered string, while `i18n` only carries the languages the
|
|
5
|
+
* auto-translation endpoint supports, so an unsupported language returns undefined.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTranslatedText: (i18n: Record<string, string> | undefined, language: string) => string | undefined;
|
|
8
|
+
//# sourceMappingURL=getTranslatedText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslatedText.d.ts","sourceRoot":"","sources":["../../../../src/utils/i18n/getTranslatedText.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACxC,UAAU,MAAM,KACf,MAAM,GAAG,SAAuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,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C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,KAAG,MA8BH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,WAI/C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,WAgB5D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAc1C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,cAAc,YAAY,GAAG,eAAe,GAAG,IAAI,EACnD,cAAc,YAAY,GAAG,eAAe,GAAG,IAAI,KAClD,OAuBF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACrC,oBAAoB,YAAY,GAAG,eAAe,GAAG,IAAI,EACzD,oBAAoB,YAAY,GAAG,eAAe,GAAG,IAAI,KACxD,OAgBF,CAAC;AAmDF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,mBAAkB,MAAU,WAiB7E,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,WAS7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,GAAG,MAAM,uBAa5D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "10.0.
|
|
4
|
+
"version": "10.0.1-beta.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-native-markdown-package": "1.8.2",
|
|
86
86
|
"react-native-url-polyfill": "^2.0.0",
|
|
87
87
|
"react-syntax-highlighter": "^16.1.0",
|
|
88
|
-
"stream-chat": "^10.0.
|
|
88
|
+
"stream-chat": "^10.0.1",
|
|
89
89
|
"use-sync-external-store": "^1.7.0",
|
|
90
90
|
"zod": "^4.1.12"
|
|
91
91
|
},
|
|
@@ -4,6 +4,7 @@ import { act, renderHook } from '@testing-library/react-native';
|
|
|
4
4
|
import { Poll, PollResponseData, PollVoteResponseData, StreamChat } from 'stream-chat';
|
|
5
5
|
|
|
6
6
|
import { ChatProvider } from '../../../../contexts/chatContext/ChatContext';
|
|
7
|
+
import { TranslationProvider } from '../../../../contexts/translationContext/TranslationContext';
|
|
7
8
|
import { useChannelPreviewPollLabel } from '../useChannelPreviewPollLabel';
|
|
8
9
|
|
|
9
10
|
const OWN_USER = { id: 'own-user' };
|
|
@@ -21,7 +22,7 @@ const generateVote = (id: string, optionId: string, createdAt: string) =>
|
|
|
21
22
|
user_id: OWN_USER.id,
|
|
22
23
|
}) as unknown as PollVoteResponseData;
|
|
23
24
|
|
|
24
|
-
const setup = (ownVotes: PollVoteResponseData[]) => {
|
|
25
|
+
const setup = (ownVotes: PollVoteResponseData[], userLanguage = 'en') => {
|
|
25
26
|
const client = {
|
|
26
27
|
deletePollVote: jest.fn(() => new Promise(() => {})),
|
|
27
28
|
user: OWN_USER,
|
|
@@ -42,7 +43,7 @@ const setup = (ownVotes: PollVoteResponseData[]) => {
|
|
|
42
43
|
latest_votes_by_option: latestVotesByOption,
|
|
43
44
|
name: 'Poll',
|
|
44
45
|
options: [
|
|
45
|
-
{ id: 'option-a', text: 'A' },
|
|
46
|
+
{ id: 'option-a', text: 'A', text_i18n: { es_text: 'A (es)', language: 'en' } },
|
|
46
47
|
{ id: 'option-b', text: 'B' },
|
|
47
48
|
],
|
|
48
49
|
own_votes: ownVotes,
|
|
@@ -53,7 +54,19 @@ const setup = (ownVotes: PollVoteResponseData[]) => {
|
|
|
53
54
|
(client as unknown as { polls: unknown }).polls = { fromState: () => poll };
|
|
54
55
|
|
|
55
56
|
const wrapper = ({ children }: PropsWithChildren) => (
|
|
56
|
-
<ChatProvider value={{ client } as never}>
|
|
57
|
+
<ChatProvider value={{ client } as never}>
|
|
58
|
+
<TranslationProvider
|
|
59
|
+
value={
|
|
60
|
+
{
|
|
61
|
+
t: (_key: string, defaultValue: string, { option }: { option?: string } = {}) =>
|
|
62
|
+
defaultValue.replace('{{ option }}', String(option)),
|
|
63
|
+
userLanguage,
|
|
64
|
+
} as never
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
</TranslationProvider>
|
|
69
|
+
</ChatProvider>
|
|
57
70
|
);
|
|
58
71
|
const hook = renderHook(() => useChannelPreviewPollLabel({ pollId: POLL_ID }), { wrapper });
|
|
59
72
|
return { ...hook, poll };
|
|
@@ -84,4 +97,16 @@ describe('useChannelPreviewPollLabel', () => {
|
|
|
84
97
|
expect(poll.data.latest_votes_by_option['option-a'] ?? []).toEqual([]);
|
|
85
98
|
expect(result.current).toBe('You voted: B');
|
|
86
99
|
});
|
|
100
|
+
|
|
101
|
+
it("labels the vote with the option's translation into the user's language", () => {
|
|
102
|
+
const vote = generateVote('vote-a', 'option-a', '2026-10-27T10:00:00.000Z');
|
|
103
|
+
const { result } = setup([vote], 'es');
|
|
104
|
+
expect(result.current).toBe('You voted: A (es)');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('labels the vote with the original option text when it has no translation', () => {
|
|
108
|
+
const vote = generateVote('vote-b', 'option-b', '2026-10-27T10:00:00.000Z');
|
|
109
|
+
const { result } = setup([vote], 'es');
|
|
110
|
+
expect(result.current).toBe('You voted: B');
|
|
111
|
+
});
|
|
87
112
|
});
|
|
@@ -5,6 +5,7 @@ import { PollState } from 'stream-chat';
|
|
|
5
5
|
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
6
6
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
7
7
|
import { useStateStore } from '../../../hooks/useStateStore';
|
|
8
|
+
import { getTranslatedText } from '../../../utils/i18n/getTranslatedText';
|
|
8
9
|
|
|
9
10
|
export type UseChannelPreviewPollLabelProps = {
|
|
10
11
|
pollId: string;
|
|
@@ -23,7 +24,7 @@ const selector = (nextValue: PollState) => ({
|
|
|
23
24
|
*/
|
|
24
25
|
export const useChannelPreviewPollLabel = ({ pollId }: UseChannelPreviewPollLabelProps) => {
|
|
25
26
|
const { client } = useChatContext();
|
|
26
|
-
const { t } = useTranslationContext();
|
|
27
|
+
const { t, userLanguage } = useTranslationContext();
|
|
27
28
|
const poll = client.polls.fromState(pollId);
|
|
28
29
|
const pollState = useStateStore(poll?.state, selector) ?? ({} as PollState);
|
|
29
30
|
const { latest_votes_by_option: latestVotesByOption, options: pollOptions } = pollState;
|
|
@@ -43,16 +44,19 @@ export const useChannelPreviewPollLabel = ({ pollId }: UseChannelPreviewPollLabe
|
|
|
43
44
|
{
|
|
44
45
|
const option = pollOptions?.find((option) => option.id === latestVotes[0].option_id);
|
|
45
46
|
const voteUser = latestVotes[0].user;
|
|
47
|
+
const optionText = option
|
|
48
|
+
? (getTranslatedText(option.text_i18n, userLanguage) ?? option.text)
|
|
49
|
+
: undefined;
|
|
46
50
|
if (voteUser.id === client.user?.id) {
|
|
47
51
|
return t('channelPreview.pollVote.byYou.label', 'You voted: {{ option }}', {
|
|
48
|
-
option:
|
|
52
|
+
option: optionText,
|
|
49
53
|
});
|
|
50
54
|
} else {
|
|
51
55
|
return t('channelPreview.pollVote.withUser.label', '{{ user }} voted: {{ option }}', {
|
|
52
56
|
user: voteUser.name || voteUser.id,
|
|
53
|
-
option:
|
|
57
|
+
option: optionText,
|
|
54
58
|
});
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
|
-
}, [latestVotes, pollOptions, client.user?.id, t]);
|
|
61
|
+
}, [latestVotes, pollOptions, client.user?.id, t, userLanguage]);
|
|
58
62
|
};
|
|
@@ -8,6 +8,7 @@ import { PollUIStateProvider } from './contexts/PollUIStateContext';
|
|
|
8
8
|
|
|
9
9
|
import { useIsPollCreatedByCurrentUser } from './hook/useIsPollCreatedByCurrentUser';
|
|
10
10
|
import { usePollState } from './hooks/usePollState';
|
|
11
|
+
import { usePollTextTranslation } from './hooks/usePollTextTranslation';
|
|
11
12
|
|
|
12
13
|
import {
|
|
13
14
|
PollContextProvider,
|
|
@@ -27,7 +28,8 @@ export type PollContentProps = Record<string, never>;
|
|
|
27
28
|
export const PollHeader = () => {
|
|
28
29
|
const styles = useStyles();
|
|
29
30
|
const { t } = useTranslationContext();
|
|
30
|
-
const { enforceUniqueVote, isClosed, maxVotesAllowed, name } = usePollState();
|
|
31
|
+
const { enforceUniqueVote, isClosed, maxVotesAllowed, name, nameI18n } = usePollState();
|
|
32
|
+
const translate = usePollTextTranslation();
|
|
31
33
|
|
|
32
34
|
const subtitle = useMemo(() => {
|
|
33
35
|
if (isClosed) {
|
|
@@ -56,7 +58,7 @@ export const PollHeader = () => {
|
|
|
56
58
|
|
|
57
59
|
return (
|
|
58
60
|
<View accessible accessibilityRole='text' style={styles.headerContainer}>
|
|
59
|
-
<Text style={[styles.headerTitle, header.title]}>{name}</Text>
|
|
61
|
+
<Text style={[styles.headerTitle, header.title]}>{translate(name, nameI18n)}</Text>
|
|
60
62
|
<Text style={[styles.headerSubtitle, header.subtitle]}>{subtitle}</Text>
|
|
61
63
|
</View>
|
|
62
64
|
);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { act, render, screen } from '@testing-library/react-native';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { Poll, PollResponseData, PollVoteResponseData, StreamChat } from 'stream-chat';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
ChatProvider,
|
|
9
|
+
OwnCapabilitiesProvider,
|
|
10
|
+
PollContextProvider,
|
|
11
|
+
ThemeProvider,
|
|
12
|
+
TranslationProvider,
|
|
13
|
+
} from '../../../contexts';
|
|
14
|
+
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
15
|
+
import { PollAnswerListItem } from '../components/PollAnswersList';
|
|
16
|
+
import { PollAllOptionsContent, PollOption } from '../components/PollOption';
|
|
17
|
+
import { PollResultsContent } from '../components/PollResults/PollResults';
|
|
18
|
+
import { PollHeader } from '../Poll';
|
|
19
|
+
|
|
20
|
+
const POLL_ID = 'poll-id';
|
|
21
|
+
|
|
22
|
+
const pollResponse = {
|
|
23
|
+
created_by: { id: 'other-user' },
|
|
24
|
+
enforce_unique_vote: true,
|
|
25
|
+
id: POLL_ID,
|
|
26
|
+
latest_answers: [],
|
|
27
|
+
latest_votes_by_option: {},
|
|
28
|
+
name: 'Favourite colour?',
|
|
29
|
+
name_i18n: { es_text: '¿Color favorito?', language: 'en' },
|
|
30
|
+
options: [
|
|
31
|
+
{ id: 'option-red', text: 'Red', text_i18n: { es_text: 'Rojo', language: 'en' } },
|
|
32
|
+
{ id: 'option-blue', text: 'Blue' },
|
|
33
|
+
],
|
|
34
|
+
vote_count: 0,
|
|
35
|
+
vote_counts_by_option: {},
|
|
36
|
+
} as unknown as PollResponseData;
|
|
37
|
+
|
|
38
|
+
const answer = {
|
|
39
|
+
answer_text: 'Green, actually',
|
|
40
|
+
answer_text_i18n: { es_text: 'Verde, en realidad', language: 'en' },
|
|
41
|
+
created_at: new Date('2026-10-27T10:00:00.000Z').getTime(),
|
|
42
|
+
id: 'answer-id',
|
|
43
|
+
is_answer: true,
|
|
44
|
+
poll_id: POLL_ID,
|
|
45
|
+
updated_at: new Date('2026-10-27T10:00:00.000Z').getTime(),
|
|
46
|
+
user: { id: 'other-user', name: 'Other' },
|
|
47
|
+
} as unknown as PollVoteResponseData;
|
|
48
|
+
|
|
49
|
+
const setup = (userLanguage: string) => {
|
|
50
|
+
const client = { user: { id: 'own-user' }, userID: 'own-user' } as unknown as StreamChat;
|
|
51
|
+
const poll = new Poll({ client, poll: pollResponse });
|
|
52
|
+
const [red, blue] = poll.data.options;
|
|
53
|
+
|
|
54
|
+
render(
|
|
55
|
+
<ThemeProvider>
|
|
56
|
+
<ChatProvider value={{ client } as never}>
|
|
57
|
+
<TranslationProvider
|
|
58
|
+
value={{ t: (key: string) => key, tDateTimeParser: dayjs, userLanguage } as never}
|
|
59
|
+
>
|
|
60
|
+
<OwnCapabilitiesProvider value={{ castPollVote: true } as never}>
|
|
61
|
+
<PollContextProvider value={{ message: generateMessage(), poll }}>
|
|
62
|
+
<PollHeader />
|
|
63
|
+
<PollOption option={red} />
|
|
64
|
+
<PollOption option={blue} />
|
|
65
|
+
<PollAnswerListItem answer={answer} />
|
|
66
|
+
</PollContextProvider>
|
|
67
|
+
</OwnCapabilitiesProvider>
|
|
68
|
+
</TranslationProvider>
|
|
69
|
+
</ChatProvider>
|
|
70
|
+
</ThemeProvider>,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return { poll };
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const renderDialogs = (userLanguage: string) => {
|
|
77
|
+
const client = { user: { id: 'own-user' }, userID: 'own-user' } as unknown as StreamChat;
|
|
78
|
+
const poll = new Poll({ client, poll: pollResponse });
|
|
79
|
+
|
|
80
|
+
return render(
|
|
81
|
+
<ThemeProvider>
|
|
82
|
+
<ChatProvider value={{ client } as never}>
|
|
83
|
+
<TranslationProvider value={{ t: (key: string) => key, userLanguage } as never}>
|
|
84
|
+
<OwnCapabilitiesProvider value={{} as never}>
|
|
85
|
+
<PollContextProvider value={{ message: generateMessage(), poll }}>
|
|
86
|
+
<PollResultsContent />
|
|
87
|
+
<PollAllOptionsContent />
|
|
88
|
+
</PollContextProvider>
|
|
89
|
+
</OwnCapabilitiesProvider>
|
|
90
|
+
</TranslationProvider>
|
|
91
|
+
</ChatProvider>
|
|
92
|
+
</ThemeProvider>,
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
describe('Poll translations', () => {
|
|
97
|
+
it("renders the question, options and answers in the user's language", () => {
|
|
98
|
+
setup('es');
|
|
99
|
+
|
|
100
|
+
expect(screen.getByText('¿Color favorito?')).toBeTruthy();
|
|
101
|
+
expect(screen.getByText('Rojo')).toBeTruthy();
|
|
102
|
+
expect(screen.getByLabelText('Rojo')).toBeTruthy();
|
|
103
|
+
expect(screen.getByText('Verde, en realidad')).toBeTruthy();
|
|
104
|
+
expect(screen.queryByText('Favourite colour?')).toBeNull();
|
|
105
|
+
expect(screen.queryByText('Red')).toBeNull();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('falls back to the original text when a text has no translation', () => {
|
|
109
|
+
setup('es');
|
|
110
|
+
|
|
111
|
+
expect(screen.getByText('Blue')).toBeTruthy();
|
|
112
|
+
expect(screen.getByLabelText('Blue')).toBeTruthy();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("renders the original texts when nothing is translated into the user's language", () => {
|
|
116
|
+
setup('de');
|
|
117
|
+
|
|
118
|
+
expect(screen.getByText('Favourite colour?')).toBeTruthy();
|
|
119
|
+
expect(screen.getByText('Red')).toBeTruthy();
|
|
120
|
+
expect(screen.getByText('Blue')).toBeTruthy();
|
|
121
|
+
expect(screen.getByText('Green, actually')).toBeTruthy();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('shows a translation that arrives later through poll.updated', () => {
|
|
125
|
+
const { poll } = setup('de');
|
|
126
|
+
expect(screen.getByText('Favourite colour?')).toBeTruthy();
|
|
127
|
+
|
|
128
|
+
act(() => {
|
|
129
|
+
poll.handlePollUpdated({
|
|
130
|
+
created_at: '2026-10-27T11:00:00.000Z',
|
|
131
|
+
poll: {
|
|
132
|
+
...pollResponse,
|
|
133
|
+
name_i18n: { de_text: 'Lieblingsfarbe?', language: 'en' },
|
|
134
|
+
},
|
|
135
|
+
type: 'poll.updated',
|
|
136
|
+
} as never);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
expect(screen.getByText('Lieblingsfarbe?')).toBeTruthy();
|
|
140
|
+
expect(screen.queryByText('Favourite colour?')).toBeNull();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('translates the question and options in the results and all-options dialogs', () => {
|
|
144
|
+
renderDialogs('es');
|
|
145
|
+
|
|
146
|
+
// Each dialog shows the question once and every option once.
|
|
147
|
+
expect(screen.getAllByText('¿Color favorito?')).toHaveLength(2);
|
|
148
|
+
expect(screen.getAllByText('Rojo')).toHaveLength(2);
|
|
149
|
+
expect(screen.getAllByText('Blue')).toHaveLength(2);
|
|
150
|
+
expect(screen.queryByText('Favourite colour?')).toBeNull();
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -21,6 +21,7 @@ import { Button } from '../../ui';
|
|
|
21
21
|
import { UserAvatar } from '../../ui/Avatar/UserAvatar';
|
|
22
22
|
import { usePollAnswersPagination } from '../hooks/usePollAnswersPagination';
|
|
23
23
|
import { usePollState } from '../hooks/usePollState';
|
|
24
|
+
import { usePollTextTranslation } from '../hooks/usePollTextTranslation';
|
|
24
25
|
|
|
25
26
|
export const AnswerListAddCommentButton = (props: PollButtonProps) => {
|
|
26
27
|
const { t } = useTranslationContext();
|
|
@@ -75,6 +76,7 @@ export const PollAnswerListItem = ({ answer }: { answer: PollVoteResponseData })
|
|
|
75
76
|
const { client } = useChatContext();
|
|
76
77
|
const { t, tDateTimeParser } = useTranslationContext();
|
|
77
78
|
const { votingVisibility } = usePollState();
|
|
79
|
+
const translate = usePollTextTranslation();
|
|
78
80
|
|
|
79
81
|
const {
|
|
80
82
|
theme: {
|
|
@@ -108,7 +110,9 @@ export const PollAnswerListItem = ({ answer }: { answer: PollVoteResponseData })
|
|
|
108
110
|
return (
|
|
109
111
|
<View style={[styles.listItemWrapper, itemStyle.wrapper]}>
|
|
110
112
|
<View style={[styles.listItemContainer, itemStyle.container]}>
|
|
111
|
-
<Text style={[styles.listItemAnswerText, itemStyle.answerText]}>
|
|
113
|
+
<Text style={[styles.listItemAnswerText, itemStyle.answerText]}>
|
|
114
|
+
{translate(answer.answer_text ?? '', answer.answer_text_i18n)}
|
|
115
|
+
</Text>
|
|
112
116
|
<View style={[styles.listItemInfoContainer, itemStyle.infoContainer]}>
|
|
113
117
|
<View style={[styles.listItemUserInfoContainer, itemStyle.userInfoContainer]}>
|
|
114
118
|
{!isAnonymous && answer.user?.image ? (
|
|
@@ -27,6 +27,7 @@ import { ProgressBar } from '../../ProgressControl/ProgressBar';
|
|
|
27
27
|
import { UserAvatarStack } from '../../ui/Avatar/AvatarStack';
|
|
28
28
|
import { useIsPollCreatedByCurrentUser } from '../hook/useIsPollCreatedByCurrentUser';
|
|
29
29
|
import { usePollState } from '../hooks/usePollState';
|
|
30
|
+
import { usePollTextTranslation } from '../hooks/usePollTextTranslation';
|
|
30
31
|
import { usePollVoteToggle } from '../hooks/usePollVoteToggle';
|
|
31
32
|
|
|
32
33
|
const pollVoteAccessibilityStates = {
|
|
@@ -48,7 +49,8 @@ export const PollAllOptionsContent = ({
|
|
|
48
49
|
additionalScrollViewProps,
|
|
49
50
|
}: Pick<PollAllOptionsContentProps, 'additionalScrollViewProps'>) => {
|
|
50
51
|
const { t } = useTranslationContext();
|
|
51
|
-
const { name, options } = usePollState();
|
|
52
|
+
const { name, nameI18n, options } = usePollState();
|
|
53
|
+
const translate = usePollTextTranslation();
|
|
52
54
|
|
|
53
55
|
const {
|
|
54
56
|
theme: {
|
|
@@ -67,7 +69,7 @@ export const PollAllOptionsContent = ({
|
|
|
67
69
|
>
|
|
68
70
|
<View style={[styles.allOptionsTitleContainer, titleContainer]}>
|
|
69
71
|
<Text style={styles.allOptionsTitleMeta}>{t('poll.question.label', 'Question')}</Text>
|
|
70
|
-
<Text style={[styles.allOptionsTitleText, titleText]}>{name}</Text>
|
|
72
|
+
<Text style={[styles.allOptionsTitleText, titleText]}>{translate(name, nameI18n)}</Text>
|
|
71
73
|
</View>
|
|
72
74
|
<View style={[styles.allOptionsListContainer, listContainer]}>
|
|
73
75
|
{options?.map((option: PollOptionClass) => (
|
|
@@ -96,6 +98,7 @@ export const PollAllOptions = ({
|
|
|
96
98
|
export const PollOption = ({ option, showProgressBar = true, forceIncoming }: PollOptionProps) => {
|
|
97
99
|
const { latestVotesByOption, voteCountsByOption, voteCount } = usePollState();
|
|
98
100
|
const { t } = useTranslationContext();
|
|
101
|
+
const translate = usePollTextTranslation();
|
|
99
102
|
const isPollCreatedByClient = useIsPollCreatedByCurrentUser();
|
|
100
103
|
// `forceIncoming` marks the full-options surface, a neutral card rather than a bubble, so it wins
|
|
101
104
|
// over poll ownership.
|
|
@@ -133,7 +136,7 @@ export const PollOption = ({ option, showProgressBar = true, forceIncoming }: Po
|
|
|
133
136
|
<View style={[styles.info, info]}>
|
|
134
137
|
<View style={[styles.header, header]}>
|
|
135
138
|
<Text ellipsizeMode='tail' numberOfLines={2} style={[styles.text, text]}>
|
|
136
|
-
{option.text}
|
|
139
|
+
{translate(option.text, option.text_i18n)}
|
|
137
140
|
</Text>
|
|
138
141
|
<View style={[styles.votesContainer, votesContainer]}>
|
|
139
142
|
{relevantVotes.length > 0 ? (
|
|
@@ -196,6 +199,7 @@ export const VoteButton = ({ forceIncoming, onPress, option }: PollVoteButtonPro
|
|
|
196
199
|
} = useTheme();
|
|
197
200
|
|
|
198
201
|
const toggleVote = usePollVoteToggle();
|
|
202
|
+
const translate = usePollTextTranslation();
|
|
199
203
|
|
|
200
204
|
const onPressHandler = useCallback(() => {
|
|
201
205
|
if (onPress) {
|
|
@@ -213,7 +217,7 @@ export const VoteButton = ({ forceIncoming, onPress, option }: PollVoteButtonPro
|
|
|
213
217
|
|
|
214
218
|
return ownCapabilities.castPollVote && !isClosed ? (
|
|
215
219
|
<Pressable
|
|
216
|
-
accessibilityLabel={option.text}
|
|
220
|
+
accessibilityLabel={translate(option.text, option.text_i18n)}
|
|
217
221
|
accessibilityRole={poll.data?.enforce_unique_vote ? 'radio' : 'checkbox'}
|
|
218
222
|
accessibilityState={accessibilityState}
|
|
219
223
|
onPress={onPressHandler}
|
|
@@ -16,6 +16,7 @@ import { useComponentsContext } from '../../../../contexts/componentsContext/Com
|
|
|
16
16
|
import { primitives } from '../../../../theme';
|
|
17
17
|
import { usePollOptionVotesPagination } from '../../hooks/usePollOptionVotesPagination';
|
|
18
18
|
import { usePollState } from '../../hooks/usePollState';
|
|
19
|
+
import { usePollTextTranslation } from '../../hooks/usePollTextTranslation';
|
|
19
20
|
|
|
20
21
|
export type PollOptionFullResultsProps = PollContextValue & {
|
|
21
22
|
option: PollOptionResponseData;
|
|
@@ -33,6 +34,8 @@ export const PollOptionFullResultsContent = ({
|
|
|
33
34
|
const { t } = useTranslationContext();
|
|
34
35
|
const { hasNextPage, loadMore, votes } = usePollOptionVotesPagination({ option });
|
|
35
36
|
const { voteCountsByOption } = usePollState();
|
|
37
|
+
const translate = usePollTextTranslation();
|
|
38
|
+
const optionText = translate(option.text, option.text_i18n);
|
|
36
39
|
|
|
37
40
|
const {
|
|
38
41
|
theme: {
|
|
@@ -46,7 +49,7 @@ export const PollOptionFullResultsContent = ({
|
|
|
46
49
|
const PollOptionFullResultsHeader = useCallback(
|
|
47
50
|
() => (
|
|
48
51
|
<View style={[styles.headerContainer, headerContainer]}>
|
|
49
|
-
<Text style={[styles.headerTitle, headerTitle]}>{
|
|
52
|
+
<Text style={[styles.headerTitle, headerTitle]}>{optionText}</Text>
|
|
50
53
|
<Text style={[styles.headerText, headerText]}>
|
|
51
54
|
{t('poll.votes.text', {
|
|
52
55
|
count: voteCountsByOption[option.id] ?? 0,
|
|
@@ -61,7 +64,7 @@ export const PollOptionFullResultsContent = ({
|
|
|
61
64
|
headerText,
|
|
62
65
|
headerTitle,
|
|
63
66
|
option.id,
|
|
64
|
-
|
|
67
|
+
optionText,
|
|
65
68
|
styles.headerContainer,
|
|
66
69
|
styles.headerText,
|
|
67
70
|
styles.headerTitle,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
import { primitives } from '../../../../theme';
|
|
22
22
|
import { usePollState } from '../../hooks/usePollState';
|
|
23
|
+
import { usePollTextTranslation } from '../../hooks/usePollTextTranslation';
|
|
23
24
|
import { GenericPollButton } from '../Button';
|
|
24
25
|
import { PollModal } from '../PollModal';
|
|
25
26
|
import { PollModalHeader } from '../PollModalHeader';
|
|
@@ -97,6 +98,7 @@ const PollResultsVoteItem = (vote: PollVoteClass) => (
|
|
|
97
98
|
export const PollResultsItem = ({ option, index }: PollResultItemProps) => {
|
|
98
99
|
const { t } = useTranslationContext();
|
|
99
100
|
const { latestVotesByOption, voteCountsByOption } = usePollState();
|
|
101
|
+
const translate = usePollTextTranslation();
|
|
100
102
|
|
|
101
103
|
const {
|
|
102
104
|
theme: {
|
|
@@ -116,7 +118,7 @@ export const PollResultsItem = ({ option, index }: PollResultItemProps) => {
|
|
|
116
118
|
{t('poll.results.optionNumber.text', 'Option {{count}}', { count: index + 1 })}
|
|
117
119
|
</Text>
|
|
118
120
|
<View style={[styles.headerContainer, headerContainer]}>
|
|
119
|
-
<Text style={[styles.title, title]}>{option.text}</Text>
|
|
121
|
+
<Text style={[styles.title, title]}>{translate(option.text, option.text_i18n)}</Text>
|
|
120
122
|
<Text style={[styles.voteCount, voteCount]}>
|
|
121
123
|
{t('poll.votes.text', {
|
|
122
124
|
count: voteCountsByOption[option.id] ?? 0,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { useComponentsContext } from '../../../../contexts/componentsContext/ComponentsContext';
|
|
15
15
|
import { primitives } from '../../../../theme';
|
|
16
16
|
import { usePollState } from '../../hooks/usePollState';
|
|
17
|
+
import { usePollTextTranslation } from '../../hooks/usePollTextTranslation';
|
|
17
18
|
|
|
18
19
|
export type PollResultsProps = PollContextValue & {
|
|
19
20
|
additionalScrollViewProps?: Partial<ScrollViewProps>;
|
|
@@ -22,7 +23,8 @@ export type PollResultsProps = PollContextValue & {
|
|
|
22
23
|
export const PollResultsContent = ({
|
|
23
24
|
additionalScrollViewProps,
|
|
24
25
|
}: Pick<PollResultsProps, 'additionalScrollViewProps'>) => {
|
|
25
|
-
const { name, options, voteCountsByOption } = usePollState();
|
|
26
|
+
const { name, nameI18n, options, voteCountsByOption } = usePollState();
|
|
27
|
+
const translate = usePollTextTranslation();
|
|
26
28
|
|
|
27
29
|
const sortedOptions = useMemo(
|
|
28
30
|
() =>
|
|
@@ -51,7 +53,7 @@ export const PollResultsContent = ({
|
|
|
51
53
|
>
|
|
52
54
|
<View style={[styles.container, container]}>
|
|
53
55
|
<Text style={[styles.titleMeta, titleMeta]}>{t('poll.question.label', 'Question')}</Text>
|
|
54
|
-
<Text style={[styles.title, title]}>{name}</Text>
|
|
56
|
+
<Text style={[styles.title, title]}>{translate(name, nameI18n)}</Text>
|
|
55
57
|
</View>
|
|
56
58
|
<View style={styles.resultsContainer}>
|
|
57
59
|
{sortedOptions.map((option, index) => (
|
|
@@ -26,6 +26,7 @@ export type UsePollStateSelectorReturnType = {
|
|
|
26
26
|
maxVotedOptionIds: string[];
|
|
27
27
|
maxVotesAllowed: number;
|
|
28
28
|
name: string;
|
|
29
|
+
nameI18n: Record<string, string> | undefined;
|
|
29
30
|
options: PollOptionResponseData[];
|
|
30
31
|
ownAnswer: PollVoteResponseData | undefined;
|
|
31
32
|
ownVotesByOptionId: Record<string, PollVoteResponseData>;
|
|
@@ -51,6 +52,7 @@ const selector = (nextValue: PollState): UsePollStateSelectorReturnType => ({
|
|
|
51
52
|
maxVotedOptionIds: nextValue.maxVotedOptionIds,
|
|
52
53
|
maxVotesAllowed: nextValue.max_votes_allowed ?? 0,
|
|
53
54
|
name: nextValue.name,
|
|
55
|
+
nameI18n: nextValue.name_i18n,
|
|
54
56
|
options: nextValue.options,
|
|
55
57
|
ownAnswer: nextValue.ownAnswer,
|
|
56
58
|
ownVotesByOptionId: nextValue.ownVotesByOptionId,
|
|
@@ -72,6 +74,7 @@ export const usePollState = (): UsePollStateReturnType => {
|
|
|
72
74
|
maxVotedOptionIds,
|
|
73
75
|
maxVotesAllowed,
|
|
74
76
|
name,
|
|
77
|
+
nameI18n,
|
|
75
78
|
options,
|
|
76
79
|
ownAnswer,
|
|
77
80
|
ownVotesByOptionId,
|
|
@@ -106,6 +109,7 @@ export const usePollState = (): UsePollStateReturnType => {
|
|
|
106
109
|
maxVotedOptionIds,
|
|
107
110
|
maxVotesAllowed,
|
|
108
111
|
name,
|
|
112
|
+
nameI18n,
|
|
109
113
|
options,
|
|
110
114
|
ownAnswer,
|
|
111
115
|
ownVotesByOptionId,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
4
|
+
import { getTranslatedText } from '../../../utils/i18n/getTranslatedText';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns `translate(original, i18n)`, which resolves a poll text (question, option or answer)
|
|
8
|
+
* into the current user's language. Falls back to `original` when there is no translation for it,
|
|
9
|
+
* the same way auto-translated message text does.
|
|
10
|
+
*/
|
|
11
|
+
export const usePollTextTranslation = () => {
|
|
12
|
+
const { userLanguage } = useTranslationContext();
|
|
13
|
+
|
|
14
|
+
return useCallback(
|
|
15
|
+
(original: string, i18n: Record<string, string> | undefined): string =>
|
|
16
|
+
getTranslatedText(i18n, userLanguage) ?? original,
|
|
17
|
+
[userLanguage],
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -59,6 +59,26 @@ describe('useTranslatedMessage', () => {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
it("doesn't translate a deleted message", async () => {
|
|
63
|
+
const message = {
|
|
64
|
+
i18n: {
|
|
65
|
+
no_text: 'Hallo verden!',
|
|
66
|
+
},
|
|
67
|
+
text: 'Hello world!',
|
|
68
|
+
type: 'deleted',
|
|
69
|
+
} as unknown as MessageResponse;
|
|
70
|
+
|
|
71
|
+
render(
|
|
72
|
+
<TranslationProvider value={{ userLanguage: 'no' } as TranslationContextValue}>
|
|
73
|
+
<TestComponent message={message} />
|
|
74
|
+
</TranslationProvider>,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
await waitFor(() => {
|
|
78
|
+
expect(screen.getByText('Hello world!')).toBeTruthy();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
62
82
|
it("returns the original text if the message doesn't contain any translations", async () => {
|
|
63
83
|
const message = {
|
|
64
84
|
text: 'Hello world!',
|