npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

i18n-full-parser

v5.0.1

Published

将前端代码解析成AST后,抽取中文词条并翻译

Downloads

14

Readme

i18nparser

将前端代码解析成AST后,抽取中文词条并翻译

how to use

import i18nparser from 'i18n-full-parser'
i18nparser.translate(configPath)({
 type: 'vue'
})

API

 configPath: String (path/to/config.js). default:(./i18nparser.config.js)
 type: String ("vue/ko/java"). set default rule for matched Node

计划

  • 1.html
  • 2.vue
  • 3.js
  • 4.jsx

html依赖html5parser转换成ast。

js使用recast解析

先基于ko和vue 进行翻译处理。

资源id+注释

中文 -》 cb.lang.template("YS_PUR_portal-fe_L_00053199") /* "保存成功" */

如何开发与调试

  • 1.快速rule验证推荐使用jest,通过测试用例来验证
  • 2.使用vscode debug来调试 默认html表示调试debug/html.js 详见.vscode/launch.json

1.中文 => 还是

3.

4.中阿顾问

5. =>

6.中文 =>中文 => 转1

7.

10.

11.

12.

13.

ko自定义Tag属性params需要翻译的中文属性一般为 title,其他根据传入组件属性自己定义

ko-html规则汇总

update 1.2.0: 由于同时存在 中文词条、中文词条:、中文词条: 三种类型,而已经翻译的词条就考虑不重复处理,所以在资源抽取时通过originData可以传入已经翻译过的词条,如果已经存在了类似的词条,就不重复翻译了,直接引用原有的。

理想情况是 如果已存在带冒号的,那么不带冒号的抽取后直接使用带冒号的cb.lang.shortTempalte(xxx). shortTemplate为自己实现的函数,内部会删除翻译后的末尾冒号使用。