Simplify i18n: remove old react-intl artifacts, rename formatMessage to t, replace FormattedMessage with t.rich().

- Rewrite messages.ts to plain string key maps (remove MessageDescriptor)
- Rewrite useMessages hook to expose t from useTranslations() directly
- Rename formatMessage → t across 193 consumer files
- Replace custom FormattedMessage component with next-intl t.rich()
- Update 52 language files to use rich text tags (<b>, <a>)
- Remove all direct imports from @/components/messages in favor of useMessages()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Mike CaoandClaude Opus 4.6 committed 2026-02-07 11:19:04 -08:00
1 parent 80cad6ea65
commit 50edb71687
247 files changed
+1660 -2194

No files matched your search

+17 -17
View File
@@ -16,7 +16,7 @@ export function ShareNav({
onItemClick?: () => void;
}) {
const share = useShare();
const { formatMessage, labels } = useMessages();
const { t, labels } = useMessages();
const { pathname } = useNavigation();
const { slug, parameters, whiteLabel } = share;
@@ -29,41 +29,41 @@ export function ShareNav({
const allItems = [
{
section: 'traffic',
label: formatMessage(labels.traffic),
label: t(labels.traffic),
items: [
{
id: 'overview',
label: formatMessage(labels.overview),
label: t(labels.overview),
icon: <Eye />,
path: renderPath(''),
},
{
id: 'events',
label: formatMessage(labels.events),
label: t(labels.events),
icon: <Lightning />,
path: renderPath('/events'),
},
{
id: 'sessions',
label: formatMessage(labels.sessions),
label: t(labels.sessions),
icon: <User />,
path: renderPath('/sessions'),
},
{
id: 'realtime',
label: formatMessage(labels.realtime),
label: t(labels.realtime),
icon: <Clock />,
path: renderPath('/realtime'),
},
{
id: 'compare',
label: formatMessage(labels.compare),
label: t(labels.compare),
icon: <AlignEndHorizontal />,
path: renderPath('/compare'),
},
{
id: 'breakdown',
label: formatMessage(labels.breakdown),
label: t(labels.breakdown),
icon: <Sheet />,
path: renderPath('/breakdown'),
},
@@ -71,29 +71,29 @@ export function ShareNav({
},
{
section: 'behavior',
label: formatMessage(labels.behavior),
label: t(labels.behavior),
items: [
{
id: 'goals',
label: formatMessage(labels.goals),
label: t(labels.goals),
icon: <Target />,
path: renderPath('/goals'),
},
{
id: 'funnels',
label: formatMessage(labels.funnels),
label: t(labels.funnels),
icon: <Funnel />,
path: renderPath('/funnels'),
},
{
id: 'journeys',
label: formatMessage(labels.journeys),
label: t(labels.journeys),
icon: <Path />,
path: renderPath('/journeys'),
},
{
id: 'retention',
label: formatMessage(labels.retention),
label: t(labels.retention),
icon: <Magnet />,
path: renderPath('/retention'),
},
@@ -101,23 +101,23 @@ export function ShareNav({
},
{
section: 'growth',
label: formatMessage(labels.growth),
label: t(labels.growth),
items: [
{
id: 'utm',
label: formatMessage(labels.utm),
label: t(labels.utm),
icon: <Tag />,
path: renderPath('/utm'),
},
{
id: 'revenue',
label: formatMessage(labels.revenue),
label: t(labels.revenue),
icon: <Money />,
path: renderPath('/revenue'),
},
{
id: 'attribution',
label: formatMessage(labels.attribution),
label: t(labels.attribution),
icon: <Network />,
path: renderPath('/attribution'),
},