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

gulp-i18n-xlsx-resolve

v0.2.0

Published

Generation language pack from Excel(xls,xlsx)

Downloads

12

Readme

gulp-i18n-xlsx-resolve

将翻译文档(xls/xlsx)转为json或ini的gulp插件;

Install

npm install gulp-i18n-xlsx-resolve --save-dev

Demo

language.xlsx :

key | English | CHINE_NEW | CHINE_OLD | bak ----|---------|-----------|-----------|---- name | languages | 多语言 | 多語言 | 项目名称 menu.new | New | 创建 | 創建 | 创建图标title

gulpfile.js :

var gulp = require('gulp');
var concat = require('gulp-concat');
var i18n = require('../');

gulp.task('i18n',function(){
    var files = gulp.src("./language.xlsx"); 
    var langMap = {
        'chine_new':"zh-cn"
        ,'chine_old':"zh-hk"
        ,'english':"en"
    };

    //生成json
    files.pipe(i18n({
        'type':'json'   // 输出为 'ini' or 'json' 默认 'json'
        ,'keyColumnName':"key"  //引用列的名称 默认为 'key'
        ,'langMap': langMap      //语言映射
        ,'passColumns':['bak']  //不输出的列
        //,'sheets': ['sheet1'] //默认处理文件中的所有表,sheets参数 可以指定要处理的表
        //,'concat':'concatfilename' //合并语言包,的包名,不设置则不合并
        //,'nosplit': false //设为true时,不拆开key字段,直接以key字段值做为键名,ini无影响 , 默认false
    }))
    .pipe(gulp.dest('./language'))

    //生成ini
    files.pipe(i18n({
            'type':"ini" //输出为ini格式文件
            ,'passColumns':['bak']
            ,'langMap':langMap
    }))
    .pipe(concat("langs.ini"))
    .pipe(gulp.dest('./language'))

})

Run gulp i18n

output:

// ./language/en.json
{"name":"languages","menu":{"new":"New"}}

// ./language/zh-cn.json
{"name":"多语言","menu":{"new":"创建"}}

// ./language/zh-cn.json
{"name":"多語言","menu":{"new":"創建"}}

// ./language/langs.ini
[en]
name=languages
menu.new=New
[zh-cn]
name=多语言
menu.new=创建
[zh-hk]
name=多語言
menu.new=創建