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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-i18n-command

v0.0.4

Published

vue 项目 i18n 辅助工具

Downloads

6

Readme

vueI18n-command

vue 项目 i18n 辅助工具

i18nConfig.js 配置文件

module.exports = {
  // 入口文件
  entry: {
    // 可以是一个数组,指定多个入口
    dir: './src',
  },
  // 需要读取的文件格式
  file: {
    test: /.*(vue|ts|js|jsx)$/,
  },
  // 忽略的文件
  ignore: {
    list: [],
  },
  // 导入国际化方法
  importInfo: {
    source: '@/locales/useLocale.js',
    imported: '$t',
    local: '_$t',
  },
	// 国际化语言文件配置
  languages: [
    {
      name: 'zh-CN',
      path: './src/locales/messages',
    },
  ],
  // 导出命令配置
  output: {
    fileName: 'editor-i18n',
    fileExtension: 'xlsx',
    path: './',
  },
  // 翻译命令配置 目前只支持百度翻译
  translate: {
    appId: '', 
    key: '',
    host: '',
  },
};

1. update

vueI18n update [--clear]

收集项目中的中文,以 hash 为 key 存放指定文件目录,示例:

// 模版文件只会收集静态文本
// 正确
<template>
	<div title="文本1">文本2</div>
</template>
// 错误 以下文本都不会收集
<template>
	<div :title="'文本1'">{{'文本2'}}</div>
</template>

// js 对象的 key 如果是中文也会被收集,避免使用中文或在配置中忽略该文件
const obj = {
	"文本1":"test"
}

--clear 参数会清空没有使用的 key (只会清除 32 位 hash 的 key)

2. translate

vueI18n translate [language]

读取中文翻译文件调用配置配置中的 api 翻译成指定的语言(如果没有传参直接读取 languages 中除中文外所有语言)

命令中可以指定多个语言 vueI18n translate en-US ja-JP

// 只会翻译空值 
// en-US.json
{
  // 会翻译
  "key":"",
  // 不会翻译
  "key":"value"
}

3. export

vueI18n export

把 locale 文件导出成 excel 示例:

| key | zh-CN | en-US | | ----- | ----- | ----- | | a | 文本 | 文本 | | a.b.c | 文本 | 文本 |

4. import

vueI18n import 把 excel 文件转成 locale json 文件,excel 格式参考 export 导出格式

5. server

vueI18n server [--port] 读取本地的 locale 文件,启动一个 http 服务,提供修改服务