lexik / LexikTranslationBundle

This Symfony bundle allow to import translation files content into the database and provide a GUI to edit translations.
MIT License
422 stars 261 forks source link

Wrap translator output to allow editing from view #157

Open rvanlaak opened 9 years ago

rvanlaak commented 9 years ago

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

cedric-g commented 9 years ago

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).

rvanlaak commented 9 years ago

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

cedric-g commented 9 years ago

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.

rvanlaak commented 9 years ago

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.

cedric-g commented 9 years ago

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

rvanlaak commented 9 years ago

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