Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/plugin-view/src/ManageViewsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ import type { ViewTabItem } from './ViewTabBar';
function useViewLabel() {
try {
const { t } = useObjectTranslation();
return (key: string, fallback: string, vars?: Record<string, unknown>) => {
return (key: string, fallback: string, vars?: Record<string, unknown>): string => {
const v = t(key, vars as any);
return !v || v === key ? fallback : v;
// i18next's `t()` is typed `string | object`; coerce so render sites and
// aria-labels always receive a string (an object child white-screens React).
return !v || v === key ? fallback : String(v);
};
} catch {
return (_k: string, fallback: string) => fallback;
Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-view/src/ViewTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ import { useObjectTranslation } from '@object-ui/react';
function useViewTabLabel() {
try {
const { t } = useObjectTranslation();
return (key: string, fallback: string, vars?: Record<string, unknown>) => {
return (key: string, fallback: string, vars?: Record<string, unknown>): string => {
const v = t(key, vars as any);
return !v || v === key ? fallback : v;
// i18next's `t()` is typed `string | object`; coerce so render sites and
// aria-labels always receive a string (an object child white-screens React).
return !v || v === key ? fallback : String(v);
};
} catch {
return (_k: string, fallback: string) => fallback;
Expand Down
Loading