import { mergeCatalogKeys } from '@datamoc/mw_games/i18n';
const catalog = {
locale: 'en', direction: 'ltr' as const,
messages: { 'confirm.quit': 'Are you sure?', 'confirm.delete': 'Are you sure?' },
};
const merged = mergeCatalogKeys(catalog, 'confirm.quit', 'confirm.delete');
console.log(Object.keys(merged.messages)); // ['confirm.quit']
Drops
mergedKeyfromcatalog, keepingsurvivingKey(and its current text) exactly as it was - the mechanical half of collapsing two keys a human decided are the same message. Apply this to every language's own catalog to merge consistently across all of them.Rewriting whichever call sites used
mergedKeyis deliberately not this function's job:mwghas no view into a game's own source tree, the same boundarycatalogUsage'sreferencedKeysalready draws - a caller doing that rewrite already knows exactly wheremergedKeyis used, since it had to findreferencedKeysthe same way to begin with.