LexikTranslationBundle icon indicating copy to clipboard operation
LexikTranslationBundle copied to clipboard

Wrap translator output to allow editing from view

Open rvanlaak opened this issue 10 years ago • 6 comments

It would be great if we could wrap the translator's output in a span, so we can edit translations from the view using http://createjs.org/

Already asked for it on StackOverflow about this, but there also should be some endpoint to save the new translation. Would your bundle allow to save translations from a XHR call?

http://stackoverflow.com/questions/31314427/wrap-translator-trans-and-transchoice-function-output-into-span

rvanlaak avatar Jul 09 '15 10:07 rvanlaak

Hi, I think the fact to wrap the translation filters output should be done in your project according to the javascrit lib you want to use. But we can provide a new url to save a translation for one locale (e.g. /translations/{id}/locale/{locale}) in addition to the current one (that save all locales).

cedric-g avatar Jul 15 '15 08:07 cedric-g

Hi, I think the fact to wrap the translation filters output should be done in your project according to the javascrit lib you want to use.

Wrapping a translation into a span is independent of Javascript right?

:+1: for the new url

rvanlaak avatar Jul 15 '15 09:07 rvanlaak

Yes the span is independent of javascript but maybe some people will prefer use another tag or different attributes, so I prefer leave people wrap the translation as they want.

cedric-g avatar Jul 16 '15 07:07 cedric-g

I agree on people deciding themselves how to wrap the translation, but do you have an idea how to do this? Is it something your bundle could solve?

It isn't related to Twig, otherwise the translations in the controller could not make use of the wrapping.

rvanlaak avatar Jul 16 '15 07:07 rvanlaak

I think the fact of wrapping a translation into a span or any other html tag would be done by a Twig filter.

cedric-g avatar Jul 28 '15 09:07 cedric-g

I should agree with you, if I should not make use of translations within my controller classes :+1:

rvanlaak avatar Jul 28 '15 09:07 rvanlaak