GetmeUK/ContentTools

how to handle repeated/duplicated keys?

seltix5 opened this issue · 2 comments

hello,
I found this tool and I think the idea is amazing! I was doing a implementation test and... when using this tool to translate text, how should I handle the repeated/duplicated keys in the page ?

for example, a table :
image

not only there wold be a problem with the post process to save the post data but also when I stop the tool only the last editable field is disabled :

image

any idea about how to approach this problem?

thanks!

Hey @seltix5 can you send me the HTML that's being generated? If you're using fixtures then I'd recommend just generating a key of the form my-key-prefix_{uuid}? We use dynamic keys for fixture data extensively without issue so hopefully this would be an option?

hello,
this is the code generated in the example :
<lang style="display:inline-block;" data-fixture="" data-ce-tag="p" data-name="lang.translations.pt-PT.ecommerce.orders.waitingpayment" class="ce-element ce-element--type-text">A aguardar pagamento</lang>
But if I use that dynamic key they will be treated as different text, but they do are the same text.

For a quick fix from my side the only option I can see is control what keys are requested and ignore keys already requested and just return the text without the html for ContentTool.

A great option wold be to treat the fixture with the same key as equal, if one is updated the others are updated too with the same text.