Socket
Book a DemoInstallSign in
Socket

convert-i18n-csv-to-yaml

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-i18n-csv-to-yaml

## Overview

latest
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

Convert i18n CSV to YAML

Overview

The convert-i18n-csv-to-yaml CLI tool converts a CSV file containing translation data into multiple YAML files. Each language will have a separate YAML file generated in the same directory as the CSV file. This tool is useful for internationalization (i18n) in projects that require language-specific configuration files.

Features

  • CSV Input: Reads a CSV file with translation keys and values.
  • YAML Output: Generates YAML files for each language specified in the CSV.
  • Automatic Escaping: Escapes double quotes in translation values to ensure proper YAML formatting.
  • Single Directory Output: Saves generated YAML files in the same directory as the CSV file.

Installation

To install the convert-i18n-csv-to-yaml tool globally, use npm:

npm install -g convert-i18n-csv-to-yaml

Example CSV File

key,en,fr,es
greeting.welcome_message,"This is a general welcome message","Este es un ""mensaje"" de bienvenida general","Este es un ""mensaje"" de bienvenida general"
greeting.user.welcome,"Welcome, user!","¡Bienvenido, usuario!","¡Bienvenido, usuario!"
greeting.user.goodbye,"Goodbye, user!","¡Adiós, usuario!","¡Adiós, usuario!"

Command

convert-i18n-csv-to-yaml ./translations.csv

Generate

en.yaml

greeting:
  welcome_message: "This is a general welcome message"
  user:
    welcome: "Welcome, user!"
    goodbye: "Goodbye, user!"

es.yaml

greeting:
  welcome_message: "Este es un \"mensaje\" de bienvenida general"
  user:
    welcome: "¡Bienvenido, usuario!"
    goodbye: "¡Adiós, usuario!"

fr.yaml

greeting:
  welcome_message: "Este es un \"mensaje\" de bienvenida general"
  user:
    welcome: "¡Bienvenido, usuario!"
    goodbye: "¡Adiós, usuario!"

FAQs

Package last updated on 09 Sep 2024

Did you know?

Socket

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