i18n-editor icon indicating copy to clipboard operation
i18n-editor copied to clipboard

Add undo/redo functionality

Open jcbvm opened this issue 9 years ago • 6 comments

Add undo/redo functionality to translation changes.

jcbvm avatar Oct 09 '16 09:10 jcbvm

@jcbvm I am starting to work with this issue and I would like to know what is the scope of the undo / redo. If this applies for word to translate or for translations in different languages? Thank you!

DiazMaxiM avatar Jun 20 '18 12:06 DiazMaxiM

@jcbvm We started to read the code and we would like you to help us understand a bit more the structure of the project, especially the functionality of TranslationTree

rozaracho avatar Jun 21 '18 10:06 rozaracho

@DiazMaxiM Not sure yet how undo/redo should work yet. Most of the time I think you might want to undo the addition of a translation or the removal of a key. So basicly action on the translation tree.

@rozaracho Sure, what do you want to know? The resources (the actual translations) are separated from the GUI, so every action performed (adding, removing, duplicating) will perform two actions, first it will update the underlying resource, secondly it will update the TranslationTree (the tree you see on the left hand side of the app). So basically the TranslationTree is responsible for showing the nodes only and performing transformations on the nodes. Both the translation tree and the resources work with so called translation keys. For the resources this are the keys of the underlying map it stores the translations in. For the tree the keys are used to build the tree structure (see TranslationTreeNode)

jcbvm avatar Jun 21 '18 11:06 jcbvm

@jcbvm every time an onKeyPress is done is the resources updated? Could we observe the resources and save the different states by applying the Pattern Moment?

DiazMaxiM avatar Jun 21 '18 22:06 DiazMaxiM

@DiazMaxiM Like I said, I think the actions performed (adding translation, removing one etc) are the actions we want to undo/redo. Not entering a translation for a language itself (the textareas already have an undo/redo function). So the best place for saving the action is in 'duplicateTranslationKey', 'renameTranslationKey', 'removeTranslationKey' and 'addTranslationKey' in the Editor class.

jcbvm avatar Jun 22 '18 08:06 jcbvm

@jcbvm We have the doubt if when we do undo about the action of eliminating we must recover the associated texts.

DiazMaxiM avatar Jun 27 '18 19:06 DiazMaxiM