Programatically compile languages with js-lingui

廉价感情. 提交于 2020-01-15 11:58:21

问题


I recently tried to integrate js-lingui into my react project. The tricky part I can't get right is compiling my languages to js files.

My goal is as follows: I will assemble my languages trough some task running (gulp or webpack maybe). This is as easy as walking trough my project, and outputting appropiate json files. However, to use these files they have to be compiled via js-lingui. And I don't know how to do this.

I am aware of lingui-cli, which allows me to do this on the cli, but I'm looking for a way to do this programatically while in my js task runner. In my dream, I could assemble the languages in-memory, pipe them trough the compile mechanism in js-lingui, and output ready to use js files.

I played around a bit with require('lingui-cli') (and its submodules), but that was of no use.

来源:https://stackoverflow.com/questions/46619062/programatically-compile-languages-with-js-lingui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!