Wednesday, January 18, 2017

makemessages for js templates

Hello,

does somebody know how can I use makemessages commad to collect translation strings from js templates?

For example, in mustache(handlebars) templates I would like to have something like this:

{{#baggage}}
<td>
    {{#gettext}}{{ num }} bag{{/gettext}}
</td>
{{/baggage}}


Where gettext is the javascript function, which used django's js function for translation through javascript-catalog:

{
//... Passed to Mustache context:
  "gettext": function () {      return function (text, render) {        return gettext(text);      }    }
//..
}


I thought that it would be easy to collect text from those templates with domain set to djangojs. But I can't find a way to do that..

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/275804b5-8bcb-4122-a1c9-c9695507eb74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment