You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior breaks the contract provided by structured KV pairs when compiling a module, at least from the CLI. I want the precise opposite of the OP.
Consider translations with just one key:
# en.yamlgreet: hello
# es.yamlgreet: hola
pnpx messageformat <dir>
yields =>
{en: ()=>'hello',es: ()=>'hola'}
As shown above, greet is missing. By just adding another key,
This broke me today unexpectedly where I had one translation with a single key. To keep the same structure, I now must artificially add an additional key so that the compiler does not drop valuable key/value pair information.
Is it agreed that this is/is not a problem? If this lossy behavior is desired, can it be opt-in only?
@cdaringe Apologies for being so late getting to this, as it's actually an entirely separate issue from the one in the parent thread. There's an oblique reference to this "feature" in the CLI docs (in the --simplify option description), but I agree that it's surprising and should not be default.
I'm considering an additional minor-level fix for this by expanding the --simplify option to provide more choices, but keeping that to not also be a breaking change is currently blocked by yargs/yargs-parser#412.
The current behavior breaks the contract provided by structured KV pairs when compiling a module, at least from the CLI. I want the precise opposite of the OP.
Consider translations with just one key:
pnpx messageformat <dir>
yields =>
As shown above,
greet
is missing. By just adding another key,The correct shape is omitted:
This broke me today unexpectedly where I had one translation with a single key. To keep the same structure, I now must artificially add an additional key so that the compiler does not drop valuable key/value pair information.
Is it agreed that this is/is not a problem? If this lossy behavior is desired, can it be opt-in only?
Originally posted by @cdaringe in #328 (comment)
The text was updated successfully, but these errors were encountered: