RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// The user-visible text of the storage code and the domain code. These folders use no host module, so the skill helper
|
||||
// can bundle them for Node. `message()` marks a key of the host catalog (`src/lib/i18n/messages.ts`), and the catalog
|
||||
// audit counts it. The text stays English here. The interface translates it with `localize()` (`../ui/text.ts`).
|
||||
|
||||
/** Mark a catalog key. It returns the text unchanged. */
|
||||
export function message<T extends string>(text: T): T {
|
||||
return text;
|
||||
}
|
||||
|
||||
/** Put the values into the `{name}` placeholders of a catalog key. */
|
||||
export function format(template: string, values: Record<string, string | number>): string {
|
||||
return template.replace(/\{(\w+)\}/g, (match, key: string) => Object.hasOwn(values, key) ? String(values[key]) : match);
|
||||
}
|
||||
Reference in New Issue
Block a user