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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xiui/i18n

v1.0.0

Published

js-国际化语言插件

Readme

纯js的国际化语言插件

针对开发插件库,或者不使用vue、react、angular等框架想要实现国际化

功能

  • 支持json,js格式
  • 嵌套层级,可使用数组
  • 同步/异步加载方案
  • 可设置模板字段

兼容性

ie9+

快速使用

安装  npm i @xiui/i8n -S

使用

假设有以下json

同步

异步

需指导文件加载目录(静态目录)
注意:此时then方法是i18n原型方法,并不是Promise的then

如果使用异步想返回一个Promise对象可以使用 i18.setLanguage('en')

进阶

###配置项
new I18n(option)

方法

s: key值匹配,嵌套层级使用.来访问 , 数组使用[0] 来访问,数字代表索引
option: 模板字段匹配,可以将变量插入到语言中

与i18.t参数一样,唯一区别会加入font标签,更改标签 配置 elTag
在动态改变语言时推荐使用这个,避免所有元素重载切换,内部原理就是会在标签上加入配置属性,当改变语言后 自动获取所有配置标签,并改变。

切换语言,locale语言类型,language语言包,不传为异步加载,返回promise对象 会自动获取 i18.h 函数生成的文本进行改变

问答

q: 不想把语言包放在静态目录下,想通过webapck打包该怎么做 a: 可以使用 import() 函数,加载语言包后 调用 i18.setLanguage(locale,response);