Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share serializer code for YAML and JSON #4090

Merged
merged 3 commits into from Aug 18, 2020
Merged

Share serializer code for YAML and JSON #4090

merged 3 commits into from Aug 18, 2020

Conversation

nijel
Copy link
Member

@nijel nijel commented Aug 4, 2020

The code is doing pretty much same thing and both implementations were covering different corner cases. This PR merges both implementations and uses single code for both formats.

Move it to the base class so that it can be reused by other storages.
The list members might be strings or dictionaries.
This should make the code less error prone as shared implementation is
used for two storages avoiding duplicating similar code.
@mkjaxxo
Copy link

mkjaxxo commented Aug 5, 2020

Does these changes also fix the conversion from JSON array

"dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],

to

"dayNames[0]": "Dimanche",
   "dayNames[1]": "Lundi",
   "dayNames[2]": "Mardi",
   "dayNames[3]": "Mercredi",
   "dayNames[4]": "Jeudi",
   "dayNames[5]": "Vendredi",
   "dayNames[6]": "Samedi",

? Thanks in advance.

@nijel
Copy link
Member Author

nijel commented Aug 5, 2020

@mkjaxxo This would work with JsonNestedFile right now. Problematic mixed cases (see #3857) are addressed by #4091 which is built on top of this.

@nijel nijel merged commit 441f8ff into translate:master Aug 18, 2020
@nijel nijel deleted the serializer branch August 18, 2020 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants