Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

messages.ts

10 lines499 Bytes

1import { getCurrentMessages, mFallback, type M } from "gt-react-native";
2​
3export type MessageResolver = M;
4​
5/**
6 * Resolves a `msg()` message in the language on screen, at call time. For code outside React
7 * (alerts, stores, notifications). Components use `useMessages()` so they re-render on a switch.
8 * English when no I18nProvider is mounted, which is also all a unit test without one gets.
9 */
10export const m = ((message, values) => (getCurrentMessages() ?? mFallback)(message, values)) as M;