serge-community / zing

Translation server for continuous localization.
https://evernote.github.io/zing/
GNU General Public License v3.0
59 stars 32 forks source link

Handle the case of an empty rendered string in Plurr preview #467

Open iafan opened 4 years ago

iafan commented 4 years ago

When the rendered string is empty, let's provide a different message, e.g. "Empty string rendered", rather than saying "Please enter placeholder <...>" (see the screenshot)

benjamimo1 commented 4 years ago

@iafan By plurr we mean this: https://github.com/loctools/plurr ?

iafan commented 4 years ago

@benjamimo1 correct!

benjamimo1 commented 4 years ago

If we input all necessary strings:

Screen Shot 2020-05-20 at 10 20 08

If we don't:

Screen Shot 2020-05-20 at 10 20 13

Is "Empty string rendered" a different case scenario as "Please enter placeholder"? Are we aiming for two different message for each scenario? I don't understand how they are different. Or should I just change the message altogether without a change in logic? Or are we aiming for a partial rendering of the message using all inputs so far. Do we consider the 0 value as an empty string? (Given the example you provided) or are we talking about #472

iafan commented 4 years ago

Yes, these are different cases. The first one is when you have missing (empty) placeholder values. The second one is an empty string as returned from Plurr formatting function.

In your screenshot above, you will never get an empty string in the output, regardless of the parameters. But there can be units which may produce an empty string as an output. See this example (try to change N to 0, 1, and 2)

benjamimo1 commented 4 years ago

OK, will give it a look now, assuming two different cases.