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

Invalid locale exception when passing arguments to translation in sw locale #62

Closed
okal opened this issue Apr 28, 2015 · 6 comments
Closed
Labels

Comments

@okal
Copy link

okal commented Apr 28, 2015

This only seems to be affecting :sw locale and nothing else. This bug doesn't occur for missing locales, which I found interesting, but it still occurs for the :sw locale even when it's missing.

I created a repo to demonstrate the bug https://github.com/okal/tower-invalid-locale

@ptaoussanis
Copy link
Member

Hi Okal, you've identified a small bug, thanks for contacting me about this.

The problem is that :sw is not a valid JVM locale. This shouldn't matter for translations, but currently does because the default make-t :fmt-fn is tower/fmt-str (which requires a valid JVM locale).

So this will only show up under the following conditions:

  1. The locale isn't a valid JVM locale.
  2. You're using the default string formatter.
  3. You're providing arguments for formatting.
  4. Your dictionary contains at least one entry for the [invalid] locale.

The fix will be to change the default :fmt-fn option for make-t, I'll try get to that in the next few days. In the meantime you can work around this by using only valid JVM locales, or by switching the make-t :fmt-fn option to:

(fn [_locale fmt & args] (apply taoensso.encore/format fmt args))

Hope that helps! Cheers :-)

@okal
Copy link
Author

okal commented Apr 28, 2015

Thank you :-)

@ptaoussanis
Copy link
Member

[com.taoensso/tower "3.1.0-beta3"] is now up on Clojars which should address this (please confirm?)

@okal
Copy link
Author

okal commented Apr 28, 2015

Works beautifully, thank you.

@okal okal closed this as completed Apr 28, 2015
@okal
Copy link
Author

okal commented Apr 28, 2015

(Hope you don't mind that I closed it. Not very well-versed on GitHub issue etiquette.)

@ptaoussanis
Copy link
Member

(Hope you don't mind that I closed it. Not very well-versed on GitHub issue etiquette.)

That's perfect, thank you :-) And thanks again for the detailed bug report. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants