Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
locale-path-loader
Advanced tools
* 文件编译阶段完成字符串替换, 在业务代码当中无需再编写过多用以加载不同语言包文件的判断语句 * 提供自动维护语言`map`表功能。就近原则,在需要进行翻译的地方,编写好`map`,`loader`会遍历所有的文件去维护最终的`map`表。也可以不启用这个功能,还是单独在语言包文件进行手动的维护
map
表功能。就近原则,在需要进行翻译的地方,编写好map
,loader
会遍历所有的文件去维护最终的map
表。也可以不启用这个功能,还是单独在语言包文件进行手动的维护图片路径
模板文件中
<img src="/static/images/${locale}/loader.png"/>
编译后 --->>>
<img src="/static/images/en/loader.png"/>
css文件中图片路径
.box {
background: url('/static/images/${locale}/loader.png')
}
编译后 --->>>
.box {
background: url('/static/images/en/loader.png')
}
class属性:
<p class="box ${locale}">
编译后 --->>>
<p class="box en">
使用JSON
格式编写
模板文件中:
<!--
<i18n>
{
"我爱你": {
"en": "I love you ",
"zh": "我爱你"
}
}
<i18n>
-->
js文件中:
/*<i18n>
{
"你好": {
"zh": "你好",
"en": "Hello"
}
}
<i18n>*/
preloader
会遍历文件并根据配置路径生成最终的语言包lang.json
{
"en": {
"我爱你": "I love you ",
"你好": "Hello"
},
"zh": {
"我爱你": "我爱你",
"你好": "你好"
}
}
map
表分散在各文件中,由loader
去遍历生成最终的map
表zh
lang.json
语言映射表生成的路径配置(如果开启了inline
模式需要对此参数进行配置) module.exports = {
....
preLoaders: [
{
test: /\.vue$/,
loaders: [
'eslint',
'locale-path??outputDir=./src/common&locale=en&inline=true'
]
}
]
....
}
module.exports = {
....
module: {
rules: [{
test: /\.vue$/,
enforce: 'pre',
use: [{
loader: 'eslint-loader',
...
}, {
loader: 'locale-path-loader',
options: {
locale: 'en',
outputDir: './src/common',
inline: true
}
}]
}]
}
....
}
FAQs
* 文件编译阶段完成字符串替换, 在业务代码当中无需再编写过多用以加载不同语言包文件的判断语句 * 提供自动维护语言`map`表功能。就近原则,在需要进行翻译的地方,编写好`map`,`loader`会遍历所有的文件去维护最终的`map`表。也可以不启用这个功能,还是单独在语言包文件进行手动的维护
The npm package locale-path-loader receives a total of 2 weekly downloads. As such, locale-path-loader popularity was classified as not popular.
We found that locale-path-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.