You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

intl-csv2json

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-csv2json

A tool for converting CSV format translation files to JSON format

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

intl-csv2json

npm version License: MIT

A command-line tool for converting CSV format multilingual files to JSON format.

中文文档 | English

Installation

npm install -g intl-csv2json

Usage

Basic Usage

intl-csv2json --input <CSV_FILE_PATH> --template <TEMPLATE_JSON_PATH>

Or use the shorthand form:

intl-csv2json -i <CSV_FILE_PATH> -t <TEMPLATE_JSON_PATH>

Interactive Command

You can also use the interactive command to run the tool:

# This will start an interactive interface to guide you through the required parameters
intl-csv2json

Parameters

  • --input, -i: CSV file path (required)
  • --template, -t: Template JSON file path (required)
  • --output, -o: Output directory (optional, default is current directory)
  • --lang-codes, -l: Language code list, comma separated, according to the order of the language columns in the CSV file (optional, default is 'zh,en')
  • --group, -g: JSON group to process (optional, default is empty)
  • --trim: Whether to trim values (optional, default is false)
  • --lang: Display language (optional, 'zh' or 'en', default is auto-detect)
  • --use-template-default, -d: Use template value as default when translation is missing (optional, default is false)

Example

intl-csv2json -i "./translations.csv" -t "./zh.json" -o "./" -l "zh,en,ar"

# Use template values as default for missing translations
intl-csv2json -i "./translations.csv" -t "./zh.json" -d

CSV File Format

The first line of the CSV file should contain language names, and translation content should start from the second line. The first column contains the source language values corresponding to the JSON template, and subsequent columns contain translations in other languages.

Example:

ChineseEnglishArabic
{{num}}金币{{num}} Coins{{num}} عملات
奖励Rewardمكافأة
{{num}}倍收益,{{goldNum}}金币{{num}}x earnings, {{goldNum}} coins{{num}}× {{goldNum}} عملات
{{num}}人{{num}} People{{num}} شخصًا
获胜排行Winning Rankترتيب الفائزين

Template JSON File Format

{
  "price": "{{num}}金币",
  "reward": "奖励",
  "earnings": "{{num}}倍收益,{{goldNum}}金币",
  "winningRank": "获胜排行",
  "common": {
    "people": "{{num}}人"
  }
}

Output

The tool will generate JSON files for corresponding languages in the specified output directory, such as en.json, tr.json, etc.

en.json

{
  "price": "{{num}} Coins",
  "reward": "Reward",
  "earnings": "{{num}}x earnings, {{goldNum}} coins",
  "winningRank": "Winning Rank",
  "common": {
    "people": "{{num}} People"
  }
}

ar.json

{
  "price": "{{num}} عملات",
  "reward": "مكافأة",
  "earnings": "{{num}}× {{goldNum}} عملات",
  "winningRank": "ترتيب الفائزين",
  "common": {
    "people": "{{num}} شخصًا"
  }
}

License

MIT

Keywords

i18n

FAQs

Package last updated on 05 Jul 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.