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

Introduce preprocess config prop #9

Merged
merged 14 commits into from
Jul 6, 2023
Merged

Introduce preprocess config prop #9

merged 14 commits into from
Jul 6, 2023

Conversation

jarda-svoboda
Copy link
Member

@jarda-svoboda jarda-svoboda commented Jul 4, 2023

This config prop should define a preprocess strategy (or a custom preprocess function). Preprocessor runs immediately after the translation data load.

Let's say we have a translation input like this:

{"a": {"b": [{"c": {"d": 1}}, {"c": {"d": 2}}]}}

'full' (default) setting will result in:

{"a.b.0.c.d": 1, "a.b.1.c.d": 2}

'preserveArrays' in:

{"a.b": [{"c.d": 1}, {"c.d": 2}]}

'none' (nothing's changed):

{"a": {"b": [{"c": {"d": 1}}, {"c": {"d": 2}}]}}

@jarda-svoboda jarda-svoboda mentioned this pull request Jul 5, 2023
@jarda-svoboda jarda-svoboda merged commit 8768fcf into master Jul 6, 2023
@jarda-svoboda jarda-svoboda deleted the feat/preprocess branch July 6, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not ready for Svelte 4.0 Can Arrays be translated?
1 participant