@jsvision/ui / loadI18n
Function: loadI18n()
loadI18n(
options):Promise<I18n>
Defined in: i18n/dist/source.d.ts:27
Load caller-owned asynchronous catalog sources and publish one complete service.
Every source receives the same concrete signal and is invoked in declaration order. Source results retain declaration order even when promises settle out of order. Optional failures become value-free diagnostics; required failures and cancellation reject without publishing a service. Network, authentication, retry, cache, and timeout policy remain caller-owned.
Parameters
options
Synchronous service options plus ordered asynchronous sources and cancellation.
Returns
Promise<I18n>
A service published only after every successful source catalog validates.
Throws
I18nError with SOURCE_FAILED, ABORTED, or a catalog validation code.
Example
const i18n = await loadI18n({
sources: [{
name: 'application',
async load({ signal }) {
const response = await fetch('/locales/en.json', { signal });
return response.json();
},
}],
});