wuchale
Version:
Protobuf-like i18n from normal code
23 lines • 785 B
JavaScript
export { MixedVisitor } from './mixed-visitor.js';
// for runtime
const rtConst = '_w_runtime_';
export function runtimeVars(wrapFunc) {
return {
rtConst,
rtTrans: `${wrapFunc(rtConst)}.t`,
rtTPlural: `${wrapFunc(rtConst)}.tp`,
rtPlural: `${wrapFunc(rtConst)}._.p`,
rtCtx: `${wrapFunc(rtConst)}.cx`,
rtTransCtx: `${wrapFunc(rtConst)}.tx`,
/** for when nesting, used in adapters with elements */
nestCtx: '_w_ctx_',
};
}
export function nonWhitespaceText(text) {
let trimmedS = text.trimStart();
const startWh = text.length - trimmedS.length;
let trimmed = trimmedS.trimEnd();
const endWh = trimmedS.length - trimmed.length;
return [startWh, trimmed, endWh];
}
//# sourceMappingURL=index.js.map