Comments (7)
Closed via 7822916
from ngx-translate-extract.
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.
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.
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.
I'm going to keep this issue open while I think about other options.
from ngx-translate-extract.
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.
Thanks, that would be good.
from ngx-translate-extract.
Related Issues (20)
- Array value erased when extract
- Extraneous path dependency?
- Angular 13 issue HOT 51
- Extract Parser error with Array.map & join
- Key 'constructor' is not parsed HOT 1
- Translations are not extracted from object in html template
- Not working with already interpolated strings and translateParams directive
- Dynamic string in translate instant
- Translation when using <ng-content>
- Allow translation files as inputs to prevent duplicate keys in an Angular workspace
- No updates in almost a year. Is this project dead? HOT 3
- my steps and how solve my error HOT 1
- Found 0 strings. HOT 1
- Getting Error while generating extracts- Ng Version -14.0.1 HOT 5
- [Question] Can we have html tags in translation strings? HOT 1
- Labels in html files preceded by variable are not found
- How can you sort by only adding new line at the bottom
- Is there a way to extract the default values from pipes
- Error generating with Angular 16 HOT 1
- Key in angular 17 new control flow get cleaned HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-translate-extract.