pmpro-register-helper icon indicating copy to clipboard operation
pmpro-register-helper copied to clipboard

Support multiple translations for Field and Box labels

Open sc0ttkclark opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. It is not very easy to translate field and box labels into multiple languages when registering them.

Describe the solution you'd like I think this should be implemented into the PMPro RH codebase (and ultimately merged into PMPro).

  • [ ] Introduce a new get_label() method to the PMProRH_Field class — This would check for a new property called $this->label_translations which could contain an array of translated labels by locale. The method would check get_user_locale() and return that label if the translation exists, otherwise return the normal $this->label.
  • [ ] Anywhere we call the $box->label ($cb->label in one place) and $field->label should be replaced with the ->get_label() method call
  • [ ] Introduce a new PMProRH_Box class which works similar to PMProRH_Field but just has the main properties for a box. The main point of this class would be to allow us to use similar logic to what we add to PMPro_Field for get_label()

sc0ttkclark avatar Sep 18 '21 16:09 sc0ttkclark