activeadmin-globalize icon indicating copy to clipboard operation
activeadmin-globalize copied to clipboard

Support multiple translated_inputs

Open tkalliom opened this issue 7 years ago • 1 comments

Use case: we had a previously monolingual application with a model with lots of attributes, presented in a specific order on the admin page. Adding translations, usage of activeadmin-globalize would have required to move all translation fields to a single section on the page, breaking earlier order. We wanted to have non-consecutive translated inputs, but it turned out that adding multiple translated_inputs resulted in trying to add multiple translation records per locale.

This patch makes the field names use keys generated from the locale, rather than the default incrementing integers. This way, even when multiple translation blocks are added, the same key ensures that the POSTed data is interpreted correctly by the server. Most of the changes were actually to the JS side: locale tab rendering and on-submit data filtering.

tkalliom avatar Feb 15 '18 14:02 tkalliom

This was done only taking into account multiple groups of attributes for a single record; probably this should be handled together with has_many support (#5)

tkalliom avatar Apr 11 '22 12:04 tkalliom