An open API service indexing awesome lists of open source software.

https://github.com/locize/resx

resx2js and js2resx converter resx resource utils
https://github.com/locize/resx

js json resources resx resxconverter translation

Last synced: 11 months ago
JSON representation

resx2js and js2resx converter resx resource utils

Awesome Lists containing this project

README

          

[![travis](https://img.shields.io/travis/locize/resx.svg)](https://travis-ci.org/locize/resx) [![npm](https://img.shields.io/npm/v/resx.svg)](https://npmjs.org/package/resx)

## Download

The source is available for download from
[GitHub](https://github.com/locize/resx/archive/master.zip).
Alternatively, you can install using npm:

```sh
npm install --save resx
```

You can then `import` or `require()` resx as normal:

```js
import resx from 'resx'
// or
const resx = require('resx')

resx.resx2js(xml, (err, res) => {})
```

Or you can direclty `import` or `require()` its functions:

```js
import resx2js from 'resx/resx2js'
// or
const resx2js = require('resx/cjs/resx2js')
```

## Usage

```js

const xml = `

















































text/microsoft-resx


2.0


System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


Hello


An application to manipulate and process resx documents


resx Data Manager

`

const js = {
"key1": "Hello",
"key2": "An application to manipulate and process resx documents",
"key.nested": "resx Data Manager"
}

import resx2js from 'resx/resx2js'
resx2js(xml, (err, res) => {
// res is like js
})

import js2resx from 'resx/js2resx'
js2resx(js, (err, res) => {
// res is like xml
})

```

Omitting the callback returns a promise

```js
const resJs = await resx2js(xml)
const resXml = await js2resx(js)
// or
resx2js(xml).then((res) => {})
js2resx(js).then((res) => {})
```