Kenneth Gonsalves <lawgon@...> writes:
>
> hi,
>
> in python to mark strings for translation one does this:
>
> string: somestring
> marked string: _("somestring")
>
> and in django templates:
> string: somestring
> marked string: {% trans "somestring" %}
>
> can anyone suggest a very quick and easy way of doing this?
Add the following code (simple and not so accurate code) to your ~/.emacs file,
and restart emacs. Open up a Python module, move the cursor to a string and
press C-c t.
------
(defun py-mark-trans ()
(interactive)
(save-excursion
(search-backward "\"")
(insert "_(")
(search-forward "\"")
(search-forward "\"")
(insert ")")))
(defun my-python-hook ()
(define-key python-mode-map [?\C-c?t] 'py-mark-trans))
(add-hook 'python-mode-hook 'my-python-hook)
-----
Regards,
Vijay
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc