From 868e613089ff3ff69cb72655d04ffa92b376e892 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 14 Aug 2024 11:47:45 +0800 Subject: [PATCH] Use msg here because the memo'ed Home doesn't re-render And see the line numbers change again in translation files --- src/locales/en.po | 16 ++++++++-------- src/locales/pseudo-LOCALE.po | 16 ++++++++-------- src/pages/home.jsx | 6 ++++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/locales/en.po b/src/locales/en.po index 1260caf0..ca91a761 100644 --- a/src/locales/en.po +++ b/src/locales/en.po @@ -526,7 +526,7 @@ msgstr "" #: src/pages/catchup.jsx:860 #: src/pages/filters.jsx:89 #: src/pages/followed-hashtags.jsx:40 -#: src/pages/home.jsx:50 +#: src/pages/home.jsx:52 #: src/pages/notifications.jsx:488 msgid "Home" msgstr "" @@ -1193,7 +1193,7 @@ msgstr "" #: src/components/nav-menu.jsx:207 #: src/components/shortcuts-settings.jsx:58 #: src/components/shortcuts-settings.jsx:143 -#: src/pages/home.jsx:221 +#: src/pages/home.jsx:223 #: src/pages/mentions.jsx:20 #: src/pages/mentions.jsx:167 #: src/pages/settings.jsx:1000 @@ -1205,8 +1205,8 @@ msgstr "" #: src/components/shortcuts-settings.jsx:49 #: src/components/shortcuts-settings.jsx:149 #: src/pages/filters.jsx:24 -#: src/pages/home.jsx:81 -#: src/pages/home.jsx:181 +#: src/pages/home.jsx:83 +#: src/pages/home.jsx:183 #: src/pages/notifications.jsx:89 #: src/pages/notifications.jsx:492 msgid "Notifications" @@ -2255,7 +2255,7 @@ msgid "New posts" msgstr "" #: src/components/timeline.jsx:548 -#: src/pages/home.jsx:210 +#: src/pages/home.jsx:212 #: src/pages/notifications.jsx:779 #: src/pages/status.jsx:945 #: src/pages/status.jsx:1318 @@ -2927,15 +2927,15 @@ msgstr "" msgid "Go to my instance (<0>{currentInstance})" msgstr "" -#: src/pages/home.jsx:206 +#: src/pages/home.jsx:208 msgid "Unable to fetch notifications." msgstr "" -#: src/pages/home.jsx:226 +#: src/pages/home.jsx:228 msgid "<0>New <1>Follow Requests" msgstr "" -#: src/pages/home.jsx:232 +#: src/pages/home.jsx:234 msgid "See all" msgstr "" diff --git a/src/locales/pseudo-LOCALE.po b/src/locales/pseudo-LOCALE.po index ec10ba09..c2748cec 100644 --- a/src/locales/pseudo-LOCALE.po +++ b/src/locales/pseudo-LOCALE.po @@ -526,7 +526,7 @@ msgstr "" #: src/pages/catchup.jsx:860 #: src/pages/filters.jsx:89 #: src/pages/followed-hashtags.jsx:40 -#: src/pages/home.jsx:50 +#: src/pages/home.jsx:52 #: src/pages/notifications.jsx:488 msgid "Home" msgstr "" @@ -1193,7 +1193,7 @@ msgstr "" #: src/components/nav-menu.jsx:207 #: src/components/shortcuts-settings.jsx:58 #: src/components/shortcuts-settings.jsx:143 -#: src/pages/home.jsx:221 +#: src/pages/home.jsx:223 #: src/pages/mentions.jsx:20 #: src/pages/mentions.jsx:167 #: src/pages/settings.jsx:1000 @@ -1205,8 +1205,8 @@ msgstr "" #: src/components/shortcuts-settings.jsx:49 #: src/components/shortcuts-settings.jsx:149 #: src/pages/filters.jsx:24 -#: src/pages/home.jsx:81 -#: src/pages/home.jsx:181 +#: src/pages/home.jsx:83 +#: src/pages/home.jsx:183 #: src/pages/notifications.jsx:89 #: src/pages/notifications.jsx:492 msgid "Notifications" @@ -2255,7 +2255,7 @@ msgid "New posts" msgstr "" #: src/components/timeline.jsx:548 -#: src/pages/home.jsx:210 +#: src/pages/home.jsx:212 #: src/pages/notifications.jsx:779 #: src/pages/status.jsx:945 #: src/pages/status.jsx:1318 @@ -2927,15 +2927,15 @@ msgstr "" msgid "Go to my instance (<0>{currentInstance})" msgstr "" -#: src/pages/home.jsx:206 +#: src/pages/home.jsx:208 msgid "Unable to fetch notifications." msgstr "" -#: src/pages/home.jsx:226 +#: src/pages/home.jsx:228 msgid "<0>New <1>Follow Requests" msgstr "" -#: src/pages/home.jsx:232 +#: src/pages/home.jsx:234 msgid "See all" msgstr "" diff --git a/src/pages/home.jsx b/src/pages/home.jsx index 829fe809..8e265ed6 100644 --- a/src/pages/home.jsx +++ b/src/pages/home.jsx @@ -1,6 +1,7 @@ import './notifications-menu.css'; -import { t, Trans } from '@lingui/macro'; +import { msg, t, Trans } from '@lingui/macro'; +import { useLingui } from '@lingui/react'; import { ControlledMenu } from '@szhsin/react-menu'; import { memo } from 'preact/compat'; import { useEffect, useRef, useState } from 'preact/hooks'; @@ -24,6 +25,7 @@ import { } from './notifications'; function Home() { + const { _ } = useLingui(); const snapStates = useSnapshot(states); useEffect(() => { (async () => { @@ -47,7 +49,7 @@ function Home() { ) : (