1 Star 0 Fork 1

good / i18n-json-to-xlsx-converter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

npm GitHub code size in bytes GitHub contributors npm GitHub last commit npms.io (final) MIT License

i18n-json-to-xlsx-converter CLI

About

i18n JSON to XLSX Converter is a CLI tool runs in a terminal, and helps you to convert a JSON file(s) to EXCEL sheet(s) including keys column defined as nested with dot notation, and the values column for those keys. Also, the CLI tool converts an EXCEL sheet to JSON file(s) by considering its values columns as individual files.

Installation

Install i18n JSON to XLSX Converter with npm

  npm install i18n-json-to-xlsx-converter

Usage/Examples

If you have installed i18n JSON to XLSX Converter you can use it with the command

   i18n-json-to-xlsx-converter --convert 'file path of the JSON or XLSX file'

If you haven't installed i18n JSON to XLSX Converter you can use it with the command

   npx i18n-json-to-xlsx-converter --convert 'file path of the JSON or XLSX file'

i18n JSON to XLSX Converter examines and understands your XLSX files if it has multiple language value columns, then it creates one or multiple JSON files from that translation columns provided.


If you want to convert multiple JSON files at once, use comma between each file paths provided

   npx i18n-json-to-xlsx-converter --convert 'filePathOne.json, filePathTwo.json'

Running Tests

To run tests, run the following command

  npm run test

Details

i18n JSON to XLSX Converter created for helping developers for generating an EXCEL file from their JSON file which is used for i18n translations. Also, developers can create one, or many JSON files from an EXCEL file for their project, as well.

Features

  • It can convert nested i18n JSON file to an EXCEL sheet
  • It can convert an EXCEL sheet to JSON file(s) easily
  • It runs in a terminal
  • Well tested, and documented

Reason behind converting a JSON file to an XLSX sheet

A multilingual application, needs translation files in the project to support multiple languages. Hence, developers need language files in JSON file format, and these JSON files need to have translation values for each key.

Assume that we have a JSON file name as en.json, and it has a content as

    {
      "nestedObject": {
        "nameOfTheArea": {
          "title": "Title",
          "subTitle": "Subtitle",
          "context": "Context"
        }
      }
    }

Since different teams are handling the translations, and they can't work on the JSON files because they are not specialized on the app development, most of them can work on an EXCEL sheet easily.

i18n JSON to XLSX Converter CLI tool helps developers to provide an EXCEL sheet ready to include translations for the other teams. It can be filled as an EXCEL file with one, or many translation columns they want to provide, and when the translation value implementation is finished, developers can get back the sheet, and convert the EXCEL sheet into JSON format again, easily.

If the provided EXCEL sheet has only one translation value column, the output JSON file will be only one, and it will have the column title as file name. In this case it'll be en.json

If the translation team fill out the values in the EXCEL sheet for only one language column for example EN, in this case the sheet needs to be in the format of

Key EN
nestedObject.nameOfTheArea.title Title
nestedObject.nameOfTheArea.title Subtitle
nestedObject.nameOfTheArea.title Context

If the provided EXCEL sheet has multiple translation value columns, the output JSON files will be multiple, and they will have the column titles as file names. In this case they'll be en.json, nl.json, de.json,

If the translation team fill out the values in the EXCEL sheet for multiple language column for example EN, NL, DE, in this case the sheet needs to be in the format of

Key EN NL DE
nestedObject.nameOfTheArea.title Title Titel Titel
nestedObject.nameOfTheArea.title Subtitle Ondertitel Untertitel
nestedObject.nameOfTheArea.title Context Context Kontext

i18n JSON to XLSX Converter will remove the manual labor for developers to create JSON file(s) from an EXCEL sheet, also will help developers to create one or more EXCEL sheet(s) from a JSON file(s) for the translation teams, easily.

Demo

Author

@ofcyln

For support, email ofcyln@gmail.com

🔗 Links

linkedin twitter

License

MIT

MIT License Copyright (c) 2021 Osman Fikret Ceylan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

1234567890 展开 收起
TypeScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liaofuqin/i18n-json-to-xlsx-converter.git
git@gitee.com:liaofuqin/i18n-json-to-xlsx-converter.git
liaofuqin
i18n-json-to-xlsx-converter
i18n-json-to-xlsx-converter
feature/multiple-json-files-to-single-xlsx

搜索帮助

344bd9b3 5694891 D2dac590 5694891