Coder Social home page Coder Social logo

potransformer's Introduction

📚Transforms JSON-files to PO-Files ↔️ PO-Files to JSON-files

Published Downloads

Motivation

In some projects, I use react-intl to internationalize them and support multi-languages. React-intl supports flatted objects as JSON-files divided into separated named-files like en_US.json or de_DE.json.

Most of my clients use POEdit to manage multi-languages in their projects. And most translations agency known and used this tool too.

For these reasons I need something to transform flatted objects as JSON-files to PO-Files to open with POEdit - so this tool/repository was born.

Features

  • Transforms an existing JSON-File to a PO-File
  • Transforms an existing PO-File to a JSON-File

Usage

Transforms an existing JSON-File to a PO-File

$ npx po-transformer po --input examples/testData.json --output examples/testData.po

# Optional
$ cat examples/testData.po
…
#. firstEntry
#: First Entry
#| First Entry
msgid "firstEntry"
msgstr "First Entry"

Transforms an existing PO-File to a JSON-File

$ npx po-transformer json --input examples/testData.po --output examples/testData.json

# Optional
$ cat examples/testData.json
{
  …
  "firstEntry": "First Entry",
  "firstEntry.item1": "First Entry - 1. Item",
  "firstEntry.item2": "First Entry - 2. Item",
  …
}

Displays the usage

$ npx po-transformer --help

Known Bugs

The current situation of this project is, that it works for my workflow and situations only. It's a very raw and straightforward implementation tailored exactly to what I need.

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.