【发布时间】:2017-02-08 14:41:57
【问题描述】:
我需要为每个入口点和语言制作本地化 .json 文件。
我们开发 Angular 应用程序,其中每个指令都可以拥有自己的所有语言的 locale .json 文件。
因此,最好将它们组合到单个文件中以用于每个入口点的语言: index.en.json、index.ru.json、index.cn.json、anotherEntry.en.json、anotherEntry.ru.json、anotherEntry.cn.json
尝试使用
const extractJSON = new ExtractTextPlugin({
filename: '[name].locale.json',
allChunks: true
});
loaders: [
...
{
test: /\.json$/,
use: extractJSON.extract({
use: [
{
loader: 'raw-loader'
},
{
loader: 'json-loader'
}
]
})
}
],
plugins: [..., extractJSON ]
还有一堆不同的加载器...
【问题讨论】:
标签: angularjs json webpack internationalization