mwg API
    Preparing search index...

    Interface Placeholder

    Python f-string-style value formatting for catalog messages: {dmg:03d}, {hp:.1%}, {name:>12}. Plain {token} interpolation stays exactly as it was; a format spec after a colon picks a deterministic, locale-independent rendering (padded damage numbers, hex ids, fixed-precision percentages), the counterpart to Format.ts, whose Intl wrappers render the locale-aware way instead ("1,234" vs "1 234").

    Supported subset of https://docs.python.org/3/library/string.html#format-specification-mini-language - [[fill]align][sign][z][#][0][width][,|_][.precision][type] with types b c d e E f F g G n o s x X %, verified case by case against CPython itself (two-digit exponents, stripped g precision, _ grouping binary/octal/hex in fours). Deliberately outside the subset: nested replacement fields in the spec ({:{width}}), which are left for a game to resolve before calling t(). Anything outside the subset returns undefined rather than guessing, and t() leaves that placeholder untouched the way it already does for a missing token.

    One divergence no implementation choice can close: JavaScript numbers carry no int/float distinction, so integer-valued floats always take the integer path (3.0 renders as 3, and takes d where CPython would raise for a float). Games that need 3.0 spell it with an explicit float type ({v:.1f}).

    import { formatSpec, tokenizeMessage, diffPlaceholders } from '@datamoc/mw_games/i18n';

    formatSpec(7, '03d'); // '007'
    formatSpec(0.125, '.1%'); // '12.5%'
    formatSpec('hi', '^7'); // ' hi '

    tokenizeMessage('Hit for {dmg:03d}!');
    // ['Hit for ', { raw: '{dmg:03d}', token: 'dmg', debug: false, conv: undefined, spec: '03d' }, '!']

    diffPlaceholders('Hit for {dmg:03d}!', 'Touché pour {dmg} !');
    // { missing: [], extra: [], changed: [{ token: 'dmg', base: ':03d', target: '' }] }
    interface Placeholder {
        conv: string | undefined;
        debug: boolean;
        raw: string;
        spec: string | undefined;
        token: string;
    }
    Index
    conv: string | undefined
    debug: boolean
    raw: string

    the placeholder exactly as written, for untouched passthrough

    spec: string | undefined
    token: string