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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@actionpower/i18n-spreadsheet-to-json

v1.1.0

Published

Converts a Google Sheets spreadsheet to a JSON file

Readme

English | 한국어

English

🌐 i18n-spreadsheet-to-json

Provides functionality to parse Google Sheets data and generate and synchronize JSON files. Helps with internationalization (i18n) for applications supporting multiple languages.

Google Sheets 데이터를 파싱하여 JSON 파일을 생성 및 동기화하는 기능을 제공합니다. 여러 언어를 지원하는 애플리케이션을 위한 국제화(i18n)를 도와줍니다.

Installation

npm install @actionpower/i18n-spreadsheet-to-json --save-dev
yarn add @actionpower/i18n-spreadsheet-to-json --dev

Usage

i18nconfig.json

Library configuration is done in the i18nconfig.json file.

Create i18nconfig.json at the root path.

//example
{
  "GOOGLE_API_KEY": "YOUR_GOOGLE_API_KEY",
  "GOOGLE_SHEET_ID": "YOUR_GOOGLE_SHEET_ID",
  "targetDir": "./locales",
  "languages": ["ko", "en", "zh"], //optional
  "customIncludedSheets": ["person", "authPage"] //optional
}

| Variable | Description | Required | Default | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------ | | GOOGLE_API_KEY | API key for using Google Sheets API. How to get it | required | - | | GOOGLE_SHEET_ID | ID of the Google Sheets document to fetch data from. You can find it in the spreadsheet's URL. docs.google.com/spreadsheets/d/[GOOGLE_SHEET_ID]/edit?usp=sharing | required | - | | targetDir | Directory path where the parsed JSON files will be saved. | required | - | | languages | Array of supported language codes. JSON files corresponding to each language code will be created in targetDir. | optional | ["ko", "en"] | | customIncludedSheets | Use this when you want to manage only specific sheets in a large spreadsheet. | optional | All sheets |

Execution

npm run i18n
yarn i18n
  • Use the above command in the terminal to update all spreadsheets.
  • If you have defined customIncludedSheets in your config, only the sheets specified in that array will be updated.

If you have set customIncludedSheets but want to update all sheets in your spreadsheet, use the --all flag:

npm run i18n --all
yarn i18n --all

If you specify a sheet name, only the sheet corresponding to that name will be updated, regardless of customIncludedSheets setting:

npm run i18n [sheetName]
yarn i18n [sheetName]

Example

  • Create a spreadsheet.

⚠Ensure that the sharing access permission is set to "Anyone with the link" (Viewer). If it is set to restricted, API requests will not be possible.

  • Open the terminal in your project directory and run the yarn i18n [sheetName] command. A JSON file will be created in the targetDir specified in the i18nconfig.json file.

./locales/ko/person.json

{
  "person": {
    "address": "서울특별시 종로구 사직로 161",
    "hobbies": ["독서", "수영", "악기 연주"]
  }
}

./locales/en/person.json

{
  "person": {
    "address": "161 Sajik-ro, Jongno-gu, Seoul, South Korea",
    "hobbies": ["Reading", "Swimming", "Playing an instrument"]
  }
}

./locales/zh/person.json

{
  "person": {
    "address": "韩国首尔特别市鐘路區社稷路161号",
    "hobbies": ["阅读", "游泳", "演奏乐器"]
  }
}

Bug Fixes

[2024/10/14] version 0.0.34

Resolved an issue where updating sheet values in bulk through the i18n command resulted in only two languages being reflected correctly in Google Sheets. Previously, when three or more languages were updated, additional languages would appear as blank values. This bug has now been fixed, ensuring that all specified languages are updated correctly.

한국어

설치

npm install @actionpower/i18n-spreadsheet-to-json --save-dev
yarn add @actionpower/i18n-spreadsheet-to-json --dev

사용법

i18nconfig.json

라이브러리 설정은 i18nconfig.json 파일에서 이루어집니다.

루트 경로에 i18nconfig.json을 생성합니다.

//example
{
  "GOOGLE_API_KEY": "YOUR_GOOGLE_API_KEY",
  "GOOGLE_SHEET_ID": "YOUR_GOOGLE_SHEET_ID",
  "targetDir": "./locales",
  "languages": ["ko", "en", "zh"], //optional
  "customIncludedSheets": ["person", "authPage"] //optional
}

| 변수 | 설명 | 필수 여부 | 기본값 | | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------ | | GOOGLE_API_KEY | Google Sheets API를 사용하기 위한 API 키입니다. 발급방법 | required | - | | GOOGLE_SHEET_ID | 데이터를 가져올 Google Sheets 문서의 ID입니다. spreadSheets의 url을 통해 ID를 알 수 있습니다. docs.google.com/spreadsheets/d/[GOOGLE_SHEET_ID]/edit?usp=sharing | required | - | | targetDir | 파싱된 JSON 파일이 저장될 디렉토리 경로입니다. | required | - | | languages | 지원하는 언어 코드의 배열입니다. 각 언어 코드에 해당하는 JSON 파일이 targetDir에 생성됩니다. | optional | ["ko", "en"] | | customIncludedSheets | 대규모 스프레드시트에서 특정 시트들만 관리하고 싶을 때 사용하세요. | optional | 전체 시트 |

실행

npm run i18n
yarn i18n
  • 터미널에서 위 명령어를 이용해 모든 스프레드 시트를 업데이트할 수 있습니다.
  • i18nconfig.jsoncustomIncludedSheets를 정의한 경우, 해당 배열에 지정된 시트만 업데이트됩니다.

customIncludedSheets를 설정했더라도 전체 시트를 모두 업데이트하고 싶다면 --all 플래그를 사용하세요:

npm run i18n --all
yarn i18n --all

특정 시트 이름을 지정하면 customIncludedSheets 설정에 관계없이 해당 이름의 시트만 업데이트됩니다:

npm run i18n [sheetName]
yarn i18n [sheetName]

Example

  • 스프레드 시트를 작성합니다.

⚠공유 엑세스 권한이 링크가 있는 모든 사용자(뷰어)로 되어있는지 확인해주세요. 제한됨으로 되어있으면 api 요청이 불가능합니다.

  • 프로젝트 경로에서 터미널을 열고 yarn i18n [sheetName] 명령어를 입력하면 i18nconfig.json 파일에 지정한 targetDir 경로에 [sheetName].json파일이 생성됩니다.

./locales/ko/person.json

{
  "person": {
    "address": "서울특별시 종로구 사직로 161",
    "hobbies": ["독서", "수영", "악기 연주"]
  }
}

./locales/en/person.json

{
  "person": {
    "address": "161 Sajik-ro, Jongno-gu, Seoul, South Korea",
    "hobbies": ["Reading", "Swimming", "Playing an instrument"]
  }
}

./locales/zh/person.json

{
  "person": {
    "address": "韩国首尔特别市鐘路區社稷路161号",
    "hobbies": ["阅读", "游泳", "演奏乐器"]
  }
}

버그 수정

[2024/10/14] version 0.0.34

i18n 명령어를 통해 시트 값을 일괄 업데이트할 때 Google Sheets에서 두 개의 언어만 정상적으로 반영되는 문제를 해결했습니다. 이전에는 세 개 이상의 언어를 업데이트할 경우 추가 언어가 빈 값으로 표시되는 버그가 있었습니다. 이 버그가 수정되어 지정한 모든 언어가 올바르게 업데이트됩니다.