8000 Bug with fn-style-args only strings · Issue #20 · taoensso/tempura · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bug with fn-style-args only strings #20

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

Closed
DjebbZ opened this issue Mar 9, 2018 · 4 comments
Closed

Bug with fn-style-args only strings #20

DjebbZ opened this issue Mar 9, 2018 · 4 comments
Assignees
Labels

Comments

@DjebbZ
Copy link
DjebbZ commented Mar 9, 2018

Hello,

When a string to translate contains only a fn-style arg (%1), tempura returns the number 0 instead of the argument.

(tr {:dict {:en {:a "aaa"
                 :b "b %1"
                 :c "%1"}}}
    [:en]
    [:c]
    ["Tempura"])
=> 0

Bug occured inside my a app. I was able to reproduce it in my app and with a fresh clone of tempura, at tag v1.1.2 in a lein repl.

Note: I know that it's a bit silly to have a text to translate where you just have nothing to translate. We happen to have a translation workflow when it can occur that not everything is translated (or translated properly) at one point.

@DjebbZ
Copy link
Author
DjebbZ commented Mar 9, 2018

After some exploration, it seems that the function returned by impl/str->vargs-fn always returns 0 for the above mentioned strings:

((impl/str->vargs-fn "%1") ["toto"])
;; => 0

((impl/str->vargs-fn "hello %1") ["world"])
=> "hello world"

Hope this helps fixing the bug.

@ptaoussanis
Copy link
Member

Hi Khalid,

Thanks for the clear error report (and for the follow-up)- that does indeed help with debugging. Will investigate and come back to you 👍

@ptaoussanis ptaoussanis self-assigned this Mar 11, 2018
ptaoussanis added a commit that referenced this issue Mar 11, 2018
@DjebbZ identified a buggy edge case for resources that have _only_ an arg.
So this bug would apply to "%1", but not "hello %1".
@ptaoussanis
Copy link
Member

Fixed with release of [com.taoensso/tempura "1.2.0"] 👍

@DjebbZ
Copy link
Author
DjebbZ commented Mar 11, 2018 via email

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
0