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

fes-locale-script

v1.0.0

Published

## 功能 1. 读取指定目录下的所有.vue文件,自动替换template与script中的语言标签为变量引用形式。以中文作为key,提高代码可读性。 例: ``` <!-- 转换前: --> <h1 label="排序">组织架构管理</h1>

Downloads

1

Readme

FES 国际化自动脚本工具

功能

  1. 读取指定目录下的所有.vue文件,自动替换template与script中的语言标签为变量引用形式。以中文作为key,提高代码可读性。 例:
<!-- 转换前: -->
<h1 label="排序">组织架构管理</h1>

<!-- 转换后: -->
<h1 :label="$t('_.排序')">{{ $t('_.组织架构管理') }}</h1>

用法

安装与执行

wnpm i -g fes-locale-gen
fes-locale-gen -d <目录> -e <排除文件>

注意事项

脚本将完成80%的重复性文本替换工作,剩余部分需要人工处理并同时做好替换后的核对。

注意以下是脚本执行后需要手动完成的部分:

  1. 需要为每个文件手动添加i18n插件的引入语句。

/pages/**.vue

import { useI18n } from '@fesjs/fes';
const { t: $t } = useI18n();
  1. 配置好fes-i18n插件并引入准备好的翻译配置文件:

/locales/en-US.js

/**  
 * 1. 引入自动生成的翻译配置 
 * (将生成的翻译配置放在其他目录的原因,locales目录会影响导航栏中语言切换选项的展示)
 * */
import enUSCommon from './locales-generated/en-US-common';

export default {
    /**  2. 使用下划线作为自动生成的命名空间 */
    _: enUSCommon,

    /**  3. 手动添加或主动覆盖的翻译配置 */
    首页: 'Front Page',
    产品管理: 'Product Management',
    天: 'Day',
    周: 'Week',
    月: 'Month',
};
  1. 手动配置页面标题与菜单的翻译

  2. 脚本执行前做好git版本管理,脚本执行后做好生成结果检查

暂未覆盖的场景

  • template中的表达式,如<p>{{ row.compare === 1 ? '是' : '否' }}</p>
  • 待补充...

TODO

  • 接入翻译服务,如百度翻译、腾讯翻译等