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

umi-plugin-translate

v0.0.7

Published

translate

Downloads

4

Readme

translate

NPM version NPM downloads

translate

安装

$ npm install @umi-plugin-translate
# or yarn add @umi-plugin-translate

使用

$ umi translate or umi tr

准备工作

此为适配umi的插件,国际化规则参照antd,或者antd-pro

image-20220314103226027

配置

在 umi中的 config/config.js,

const translate={
    /** 翻译文件的后缀名,一般在使用umi创建项目时,是有js或者ts两种方式的*/
    suffix: 'ts',
    /** 输出翻译文件的对应表,一个对象代表一个语言
     * type:翻译对应的语言(谷歌翻译对应的语言标识)
     * fileName代表umi对应的语言文件夹和文件名(文件名和文件夹是一致的)
     * */
    translateTypes: [{ type: 'en', fileName: 'en-US' }, { type: 'ja', fileName: 'ja-JP' }],
        /**  输入的翻译类型(以哪种语言作为翻译的源),默认是中文
     * type:翻译对应的语言(谷歌翻译对应的语言标识)
     * fileName代表umi对应的语言文件夹和文件名(文件名和文件夹是一致的)
     * */
    from: { type: 'zh-CN', fileName: 'zh-CN' },
    /** 默认国际化文件的路径*/
    path: 'src/locales',
    /** {
            'en-US':{
              "运营组织层级":"set"
            },
            'ja-JP':{
              "运营组织层级":"set日本"
            }
          }
    */
    humanTranslate:{}
}
  • suffix 翻译文件的后缀名,一般在使用umi创建项目时,是有js或者ts两种方式的
  • translateTypes 输出翻译文件的对应表,一个对象代表一个语言,翻译语言参照
  • from 输入的翻译类型(以哪种语言作为翻译的源),默认是中文
  • path 默认国际化文件的路径(默认以antd-pro的位置src/locales)
  • humanTranslate 在翻译到这个文本时会使用设置的文本,而不会使用机翻。如:en-US是国际化的本地代码,跟translateTypes中的fileName保持一致,他的子对象key是被翻译的字符串,value是翻译后的对应语言的文本

LICENSE

MIT