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

how to use trans in attributes #39

Closed
qnub opened this issue Oct 20, 2011 · 4 comments
Closed

how to use trans in attributes #39

qnub opened this issue Oct 20, 2011 · 4 comments

Comments

@qnub
Copy link

qnub commented Oct 20, 2011

I need to inser localized value into input field

%input{'name':'text', 'type':'text', 'value':'localized_value'}

need to be like

%input{'name':'text', 'type':'text', 'value':'
  - trans
    Введите значение'}

How can i do that?

@neoascetic
Copy link
Contributor

It is similar with #38
Currently I'm use logic in attributes like this:

%input{'name':'text', 'type':'text', 'value':'{% trans "Введите значение" %}'}

just like raw django template strings. But, again, we need more haml-way to use attributes.

@culebron
Copy link
Contributor

culebron commented Nov 4, 2011

I use HamlPy on a real project, and too often have to fall back to HTML&Django syntax for the issues like this.

I think such syntax can fit haml:

%tagname{'attrname': - trans 'my text', 'another_attribute': = variable, = dynamic_attr_name: 'static value', = dynamic_name: = dynamic value}

I'm not sure if it's easy to read though.

@andreif
Copy link
Contributor

andreif commented Nov 6, 2011

A more hamlish way would be

%tagname{attrname: trans('my text'), another_attribute: variable, dynamic_attr_name => 'static value', dynamic_name => dynamic value}

Note, that HamlPy already supports

%tagname{attrname: 'my text'}

@bcoughlan
Copy link
Collaborator

Closing this as it's a duplicate to #38

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

5 participants