Socket
Socket
Sign inDemoInstall

nuxt-translation-manager

Package Overview
Dependencies
163
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nuxt-translation-manager

Simple and easy to use translation manager for nuxt and nuxt-i18n that allows to manage translations from a single CSV file.


Version published
Weekly downloads
43
increased by126.32%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

v1.1.0

compare changes

🚀 Enhancements

  • Added comments support in the csv file (9c625bb)

🩹 Fixes

  • Adopt forward-compatible approach to builder:watch (90aecf0)
  • Don't use shadowed resolve (79558f7)
  • Typescript complains not finding .nuxt (c6a62d7)
  • dev: Trying to generate locales when the module generate its own types (955da25)

📖 Documentation

  • Improve readme.md (b217c9d)
  • Use new nuxi module add command in installation (05d4948)
  • Added Codesandbox example (ac6b64d)

🏡 Chore

  • Added vscode settings to use project typescript version (2fc7ac8)
  • Update import from 'node' to 'node:fs' (904982a)
  • Remove generated json files (f8b373b)
  • dev-deps: Updated deps (62fce4f)

❤️ Contributors

Readme

Source

Nuxt Translation Manager

npm version npm downloads License Nuxt

temp-Image4v-TX6-F.jpg

Simple and easy to use translation manager for nuxt and nuxt-i18n that allows to manage translations from a single CSV file.

Features

  • Manage translations from a single CSV file
  • Hot module reload whenever the csv file is updated

Quick Setup

  1. Add nuxt-translation-manager dependency to your project
npx nuxi@latest module add translation-manager

Manual Installation

  1. Add nuxt-translation-manager dependency to your project
npm install -D nuxt-translation-manager

pnpm install -D nuxt-translation-manager

yarn add -D nuxt-translation-manager
  1. Add nuxt-translation-manager to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-translation-manager'
  ]
})

That's it! You can now use Nuxt Translation Manager in your Nuxt app ✨

Usage

Create translations.csv file in your langDir

echo 'Key,"en-US","es-ES","ca-ES"
login,"Login","Acceder","Accedir"' > path-to-your-langDir/translations.csv
# replace `path-to-your-langDir`

This will generate a CSV file that looks like this:

Keyen-USfrde
helloHelloBonjourHallo
goodbyeGoodbyeAu revoirAuf Wiedersehen
thanksThanksMerciDanke

Be sure to use the format lang-code in the header row e.g. es-ES

Be sure to set the delimiter to comma in your csv editor ,

You can use comments in your csv file using #

✨ Tip: you can use Edit CSV Extension for VSCode to manage your csv file inside of vscode

View raw csv code
Key,"English, en-US","French, fr","German, de"
hello,"Hello","Bonjour","Hallo"
goodbye,"Goodbye","Au revoir","Auf Wiedersehen"
thanks,"Thanks","Merci","Danke"
# COMMENTS TEST
comment-test,"Comment test","Test comentario","Test comentari"
### MULTILINE COMMENT ###
### ANOTHER COMMENT ####
comment-multi,"Comment test","Test comentario","Test comentari"

Options

// config key
export default defineNuxtConfig({
  'translation-manager': {}
})

interface ModuleOptions {
  /**
   * nuxt-i18n lang dir
   *
   * @default 'locales'
   */
  langDir?: string
  /**
   * csv file name without .csv file extension
   *
   * @default 'translations'
   */
  translationFileName?: string
  /**
   * where to store json files
   *
   * @default 'langDir'
   */
  outputDir?: string
}

Development

# Install dependencies
pnpm install

# Generate type stubs
pnpm run dev:prepare

# Develop with the playground
pnpm run dev

# Build the playground
pnpm run dev:build

# Run ESLint
pnpm run lint

# Run Vitest
pnpm run test
pnpm run test:watch

# Release new version
pnpm run release

Credits

Inspired by Quasalang CLI by Danny Connell

Keywords

FAQs

Last updated on 05 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc