Git Product home page Git Product logo

Comments (7)

biesbjerg avatar biesbjerg commented on July 30, 2024 3

Closed via 7822916

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

I'm not sure this can be implemented.

How would we tell the difference between PAGES.SHARED.MeetingNotFound which we want nested and STRING.WITH.DOTS which we wouldn't want nested?

Personally I'm using english strings as keys in my projects, which could easily confuse any JSON nesting logic.

from ngx-translate-extract.

sharmajnu avatar sharmajnu commented on July 30, 2024

Could it be implemented with a switch? In a large project it will be really difficult to manage all the keys if they are at the same level. A switch which treats DOT(.) as nested structure would be idle and the default functionality could be as it is today. what do you think about that?

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

Supporting nested JSON means way more complex code to handle merging of strings and we would have to introduce a CLI argument that only applies to JSON format, making the tool more complicated to use, understand and maintain.

You can use the dot structure you do now in combination with the just added --sort argument to sort keys alphabetically. That way your translations are still grouped in the translation file. Personally I think that's Good Enough™.

Alternatively you could write a custom script to post process your translations to convert dot keys to nested JSON.

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

I'm going to keep this issue open while I think about other options.

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

I think we could add a new format/compiler. A NestedJsonCompiler that flattens strings on parse and unflattens on compile.

Used via ng2-translate-extract ... --format=nested-json

from ngx-translate-extract.

sharmajnu avatar sharmajnu commented on July 30, 2024

Thanks, that would be good.

from ngx-translate-extract.

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.