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

*gettext macros fail with string sigils #57

Closed
whatyouhide opened this issue Nov 24, 2015 · 5 comments
Closed

*gettext macros fail with string sigils #57

whatyouhide opened this issue Nov 24, 2015 · 5 comments
Assignees

Comments

@whatyouhide
Copy link
Contributor

import MyApp.Gettext
gettext ~s(foo)

fails with ** (ArgumentError) msgid must be a string literal.

@whatyouhide whatyouhide self-assigned this Nov 24, 2015
@josevalim
Copy link
Contributor

Weird, I thought we macro expanded them?

@whatyouhide
Copy link
Contributor Author

We do, I'm not sure why this happens. I'll investigate!

@whatyouhide
Copy link
Contributor Author

@josevalim ok it's because

Macro.expand (quote do: ~s(foo)), __ENV__
#=> {:<<>>, [], ["foo"]}

but we check for is_binary(msgid) after expanding. I can manually check for the {:<<>>, _, [binary]} pattern.

@josevalim
Copy link
Contributor

Yes, we need to check for :<<>> as long as all entries are binaries. I will update sigil_s to return a binary if such is guaranteed.

@whatyouhide
Copy link
Contributor Author

Closed by 2f183e3! /cc @josevalim

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

No branches or pull requests

2 participants