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

language-packer

v1.0.4

Published

language-packer

Downloads

3

Readme

安装插件

npm install language-packer

插件使用方法(以下以 Vue 使用为例,但不只限于 Vue 使用)

自动挂载 Vue.prototype.$t

import LanguagePacker from 'language-packer/index'

Vue.use(LanguagePacker, { list: [{ name: '中文', code: 'zh' }, { name: '英文', code: 'en' }] })

手动挂载 Vue.prototype.$t

import LanguagePacker from 'language-packer/src/index'

Vue.prototype.$t = LanguagePacker({ list: [{ name: '中文', code: 'zh' }, { name: '英文', code: 'en' }] })

LanguagePacker(options) options 配置说明

  • list 语言选择列表,数据结构 [{ name: '中文', code: 'zh' }]
  • code 默认语言(list 第一个)
  • status 运行状态(false)
  • autoKey 自动生成语言 key,采用 crc32 算法生成 (false)
  • mark 检索标记('<$$$-LanguagePacker-$$$>')
  • title 弹框标题(翻译)
  • cancelBtnName 弹框取消按钮名称(取消)
  • confirmBtnName 弹框确定按钮名称(确定)
  • zIndex 弹框、翻译按钮层级(默认 666666)

设置语言

this.$t.setCode('zh')

开启(true)、关闭(false)翻译

this.$t.setStatus(true)

启用插件(以下 webpack 为例,vue-cli 在 configureWebpack 下配置)

const LanguageService = require('language-packer/src/service')

configureWebpack: {
    plugins: [
        new LanguageService()
    ]
}

翻译后不刷新浏览器,添加以下配置(文件变化导致热更刷新浏览器)

vue.config.js 添加配置,ignored 忽略目录(LanguageService 配置的 outDir 目录)

configureWebpack: {
    devServer: {
      watchOptions: {
        ignored: [/src\/language/]
      }
    }
}

注意:LanguagePacker 一般在 main.js 中执行;LanguageService 以插件的方式挂载,两者必须同时使用。