Giter Club home page Giter Club logo

unplugin-sheet-i18n's Introduction

unplugin-sheet-i18n TypeScript heart icon

npm version npm downloads Codecov Bundlejs jsDocs.io

unplugin-sheet-i18n enables doing your i18n in a [spread]sheet for a better collaborative experience with non-coders and maintainability.

Features

  • Supports CSV, TSV, DSV, Excel/Spreadsheets (XLS[XMB], ODT), powered by SheetJS and papaparse
  • File-to-file convert: en.csv -> en.json
  • File-to-multiple convert: i18n.csv -> en.json, vi.json, fr.json,...
  • Output merging: i18n_a.csv + i18n_b.csv -> en.json
  • File generation: i18n_files.csv -> cloud_en.json, cloud_fr.json, template_en.html, template_fr.html
  • And more!

Usage

>See a few examples usage here<

Install package:

# npm
npm install unplugin-sheet-i18n

# yarn
yarn add unplugin-sheet-i18n

# pnpm (recommended)
pnpm install unplugin-sheet-i18n

Setup:

Vite
// vite.config.ts
import SheetI18n from 'unplugin-sheet-i18n/vite'

export default defineConfig({
  plugins: [
    SheetI18n({ /* options */ }),
  ],
})


Rollup
// rollup.config.js
import SheetI18n from 'unplugin-sheet-i18n/rollup'

export default {
  plugins: [
    SheetI18n({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-sheet-i18n/webpack')({ /* options */ })
  ]
}


Nuxt
// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['unplugin-sheet-i18n/nuxt', { /* options */ }],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-sheet-i18n/webpack')({ /* options */ }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import SheetI18n from 'unplugin-sheet-i18n/esbuild'

build({
  plugins: [SheetI18n()],
})


unbuild
// build.config.ts
import { defineBuildConfig } from 'unbuild'
import SheetI18n from 'unplugin-sheet-i18n/rollup'

export default defineBuildConfig({
  hooks: {
    'rollup:options': function (ctx, options) {
      options.plugins = [options.plugins, SheetI18n({
      })]
    },
  },
})


programmatic

See it in action at starter-fullstack

// index.ts
import { createContext } from 'unplugin-sheet-i18n'

createContext({
  outDir: 'dist',
}).scanConvert()


Options:

See Options

Roadmap

  • Add example repos
  • Add tests

License

MIT License © 2023 NamesMT

unplugin-sheet-i18n's People

Contributors

namesmt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

unplugin-sheet-i18n's Issues

webpack plugin require issue (ERR_PACKAGE_PATH_NOT_EXPORTE)

webpack build error >

[webpack-cli] Failed to load '/Users/smkoak/Documents/hive_console_fe/apps/products/remote-play/webpack.config.js' config
[webpack-cli] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './webpack' is not defined by "exports" in /Users/smkoak/Documents/hive_console_fe/apps/products/remote-play/node_modules/unplugin-sheet-i18n/package.json
at exportsNotFound (node:internal/modules/esm/resolve:304:10)
at packageExportsResolve (node:internal/modules/esm/resolve:594:13)
at resolveExports (node:internal/modules/cjs/loader:590:36)
at Module._findPath (node:internal/modules/cjs/loader:667:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1129:27)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:179:18)
at Object. (/Users/smkoak/Documents/hive_console_fe/apps/products/remote-play/config/webpack.common.js:11:19)
at Module._compile (node:internal/modules/cjs/loader:1369:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
 ELIFECYCLE  Command failed with exit code 2.


// webpack.config.js
module.exports = {
/* ... /
plugins: [
require('unplugin-sheet-i18n/webpack')({ /
options */ })
]
}

I set it up as below to use it as a webpack plugin, but the above error occurs. Is there a solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.