Pumpkin/v0.1/i18n.wit
Demetrius Kanios a902e9d548 Squashed 'crates/pumpkin-plugin-wit/' content from commit 1ad73fff1
git-subtree-dir: crates/pumpkin-plugin-wit
git-subtree-split: 1ad73fff1e0a9e21b99255816df5f99f6260c1b9
2026-09-14 11:02:09 -07:00

22 lines
758 B
Plaintext

interface i18n {
use common.{locale};
/// Retrieves a translated string from the host.
///
/// # Arguments
/// * `key`: The namespaced translation key (e.g. `pumpkin:my_key`).
/// * `locale`: The target locale.
///
/// # Returns
/// The localized string, falling back to English or the key itself.
translate: func(key: string, locale: locale) -> string;
/// Loads custom translations from a JSON string.
///
/// # Arguments
/// * `namespace`: The namespace to associate these keys with.
/// * `json`: A JSON string containing a flat map of translations.
/// * `locale`: The target locale for these translations.
load-translations: func(namespace: string, json: string, locale: locale);
}