UNPKG

next-intl

Version:

Internationalization (i18n) for Next.js

2 lines (1 loc) 448 B
import t from"path";import{getFormatExtension as s,resolveCodec as e}from"./format/index.js";let o=null;function a(a){const n=this.getOptions(),r=this.async(),i=s(n.messages.format);(async function(t,s){return o||(o=await e(t.messages.format,s)),o})(n,this.rootContext).then((s=>{const e=t.basename(this.resourcePath,i),o=s.toJSONString(a,{locale:e}),n=`export default JSON.parse(${JSON.stringify(o)});`;r(null,n)})).catch(r)}export{a as default};