Skip to content

Commit 51b21fc

Browse files
Merge pull request #585 from 1enify/i18n-2
i18n: Refactor strings with formated numbers
2 parents 94feb90 + 0ecfdd7 commit 51b21fc

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/components/InVoiceActions.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import RouterEndpoints from "@/common/RouterEndpoints";
88
import { CustomLink } from "./ui/CustomLink";
99
import { timeSinceDigital } from "@/common/date";
1010
import Button from "./ui/Button";
11-
import { useTransContext } from "@nerimity/solid-i18lite";
11+
import { Trans } from "@nerimity/solid-i18lite";
1212

1313
const InVoiceActionsContainer = styled(FlexColumn)`
1414
background-color: rgb(15, 15, 15);
@@ -46,8 +46,6 @@ export default function InVoiceActions(props: { style?: JSX.CSSProperties }) {
4646
return RouterEndpoints.SERVER_MESSAGES(server()?.id!, channel()?.id!);
4747
};
4848

49-
const [t] = useTransContext();
50-
5149
return (
5250
<Show when={channelId()}>
5351
<InVoiceActionsContainer style={props?.style}>
@@ -59,9 +57,7 @@ export default function InVoiceActions(props: { style?: JSX.CSSProperties }) {
5957
style={{ padding: "10px", "padding-right": "5px" }}
6058
/>
6159
<DetailsContainer>
62-
<Text size={12}>
63-
{t("inVoiceActions.connectedFor")} <CallTime channelId={channelId()!} />
64-
</Text>
60+
<CallTime channelId={channelId()!} />
6561
<CustomLink
6662
href={href()}
6763
decoration
@@ -197,13 +193,16 @@ function CallTime(props: { channelId: string }) {
197193
<Show when={channel()?.callJoinedAt}>
198194
<Text
199195
size={12}
200-
opacity={0.6}
201196
style={{
202-
"margin-left": "auto",
203197
"font-variant-numeric": "tabular-nums"
204198
}}
205199
>
206-
{time()}
200+
<Trans
201+
key="inVoiceActions.connectedFor"
202+
options={{ time: time() }}
203+
>
204+
Connected for <Text size={12} opacity={0.6}>{"time"}</Text>
205+
</Trans>
207206
</Text>
208207
</Show>
209208
);

src/components/post-area/PostItem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,12 @@ const PollEmbed = (props: { post: Post; poll: RawPostPoll }) => {
699699
<div class={style.footer}>
700700
<span class={style.votes}>
701701
<Text size={12}>
702-
{t("posts.voteCount", { count: props.poll._count.votedUsers })}
702+
<Trans
703+
key="posts.voteCount"
704+
options={{ count: props.poll._count.votedUsers }}
705+
>
706+
<Text size={12} opacity={0.6}>{"count"}</Text> vote(s)
707+
</Trans>
703708
</Text>
704709
</span>
705710

src/locales/list/en-gb.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@
10271027
"reposted": "Reposted",
10281028
"repostedBy": "Reposted by",
10291029
"voteButton": "Vote",
1030-
"voteCount": "{{count}} vote(s)",
1030+
"voteCount": "<1>{{count}}</1> vote(s)",
10311031
"copyPostButton": "Copy Post",
10321032
"sections": {
10331033
"replies": "Replies ({{count}})",
@@ -1116,7 +1116,7 @@
11161116
"inVoice": "In voice"
11171117
},
11181118
"inVoiceActions": {
1119-
"connectedFor": "Connected for"
1119+
"connectedFor": "Connected for <1>{{time}}</1>"
11201120
},
11211121
"informationDrawer": {
11221122
"info": "Info",

0 commit comments

Comments
 (0)