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

Load sprintf.js via npm #46

Closed
wants to merge 2 commits into from
Closed

Load sprintf.js via npm #46

wants to merge 2 commits into from

Conversation

swissspidy
Copy link
Contributor

This requires the sprintf.js npm module instead of inlining it and updates the library from 0.7-beta1 to version 1.0.3. A few changes to the tests were required to accommodate for the change.

See #41.

This requires the npm module instead of inlining it and updates sprintf.js from 0.7-beta1 to version 1.0.3. A few changes to the tests were required to accomodate for the version bump.
Copy link
Member

@SlexAxton SlexAxton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The two reasons I inline sprintf in the past were because of the undefined behavior here, and because it wasn't on npm at the time I wrote this :).

Would love to not have to change this undefined behavior, it's never what people want.

@swissspidy
Copy link
Contributor Author

What do you think about throwing an error instead of just turning undefined into an empty string? I think it would be better to make people aware of their errors instead of suppressing them.

I'd be happy to add support for this to the sprintf library if that sounds good to you.

@SlexAxton
Copy link
Member

Is it really an error to have empty values? I think runtime errors in
translation are never more helpful than just outputting empty strings. I'd
be ok with adding a hook to be notified of these problems, but just
erroring out and not rendering someone's text seems like an extreme
punishment for a missing variable.
On Fri, Sep 23, 2016 at 1:34 PM Pascal Birchler [email protected]
wrote:

What do you think about throwing an error instead of just turning
undefined into an empty string? I think it would be better to make people
aware of their errors instead of suppressing them.

I'd be happy to add support for this to the sprintf library if that sounds
good to you.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#46 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAF5Kl2ZgnIK5EybJWz9x_WcTHunsG1Cks5qtBvCgaJpZM4KE7s0
.

@swissspidy swissspidy closed this Sep 19, 2017
@swissspidy
Copy link
Contributor Author

@SlexAxton Just stumbled upon this again. What do you think about using the latest version of sprintf from npm (see also #56) and then wrap a little helper function around them to handle undefined? Happy to submit a PR.

@SlexAxton
Copy link
Member

SlexAxton commented Aug 10, 2018 via email

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.

2 participants