wintercms / wn-translate-plugin

Translate plugin for Winter CMS
MIT License
14 stars 18 forks source link

Fix issue with loading translated data with arrayNames #84

Closed nmiyazaki-chapleau closed 4 months ago

nmiyazaki-chapleau commented 6 months ago

A previous PR I did, #83, added a fix for obtaining data with arrayNames in MLControl's getLocaleFieldName method. However, loading data with arrayNames was not implemented. This PR aims to fix this issue by doing a basic implementation within the getLocaleValue and getLocaleSaveValue methods. It has not been thoroughly tested; the main tests were for an implementation with the Blocks plugin, which uses arrayNames.

Any input is welcome.

LukeTowers commented 5 months ago

Seems fine to me, @mjauvin any thoughts? Related: wintercms/wn-blocks-plugin#34

mjauvin commented 5 months ago

I'll look into this when I get back from my vacation.

mjauvin commented 5 months ago

A previous PR I did, #83, added a fix for obtaining data with arrayNames in MLControl's getLocaleFieldName method. However, loading data with arrayNames was not implemented. This PR aims to fix this issue by doing a basic implementation within the getLocaleValue and getLocaleSaveValue methods. It has not been thoroughly tested; the main tests were for an implementation with the Blocks plugin, which uses arrayNames.

Any input is welcome.

Does this work when $this->valueFrom is used as well?

LukeTowers commented 4 months ago

@nmiyazaki-chapleau are you still interested in getting this merged?

nmiyazaki-chapleau commented 4 months ago

A previous PR I did, #83, added a fix for obtaining data with arrayNames in MLControl's getLocaleFieldName method. However, loading data with arrayNames was not implemented. This PR aims to fix this issue by doing a basic implementation within the getLocaleValue and getLocaleSaveValue methods. It has not been thoroughly tested; the main tests were for an implementation with the Blocks plugin, which uses arrayNames. Any input is welcome.

Does this work when $this->valueFrom is used as well?

As long as arrayName should be applied to $this->valueFrom, then yes, as this uses the $key variable.

@nmiyazaki-chapleau are you still interested in getting this merged?

Yes, thank you and thanks @mjauvin for the emrge. I haven't worked with winter in a bit, but getting these things done helps. Appreciate all the work you've done!