Coder Social home page Coder Social logo

Comments (6)

perrin4869 avatar perrin4869 commented on June 19, 2024

I'll merge a PR implementing this :)
Maybe add the ability to specify a json formatter?

from i18next-gettext-converter.

Cielquan avatar Cielquan commented on June 19, 2024

I'll merge a PR implementing this :)

Thanks :)

Maybe add the ability to specify a json formatter?

That sound also like a good idea. Maybe both? You can either set a number or a string containing a formatter wich then gets mapped to a number?

from i18next-gettext-converter.

perrin4869 avatar perrin4869 commented on June 19, 2024

I think one of the two is better? I can go with either!
Can't think of a name for a combined option, it would be something like jsonFormatter or jsonTabWidth I think?

from i18next-gettext-converter.

Cielquan avatar Cielquan commented on June 19, 2024

Well the naming sure is a problem indeed.

I guess then when both options are being implemented two separate options should be created, but then there would be the issue of which takes precedence and so on. So yeah, I guess one would be better?

But when only one is implemented I would propose to take the more general one with jsonTabWidth as it is more flexible and the user can do everything the jsonFormatter option would allow and more.

What do you think?

from i18next-gettext-converter.

perrin4869 avatar perrin4869 commented on June 19, 2024

Well, jsonFormatter is the more general option.
You could specify something like --jsonFormatter ./jsonFormatter.js which could look something like:

import beautify from "json-beautify";

export default (obj) => beatufy(obj, null, 2, 100));

This is using something like https://www.npmjs.com/package/json-beautify
In this case you can also set the maximum line width.

from i18next-gettext-converter.

Cielquan avatar Cielquan commented on June 19, 2024

Ah ok, I had a different approach in mind. I thought that the formatter option would just be a string, which then would get mapped into a number. But your approach is much better. Yes with this I would agree with you, that this would be the more general option. I like it.

from i18next-gettext-converter.

Related Issues (20)

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.