pmpro-register-helper
pmpro-register-helper copied to clipboard
Support multiple translations for Field and Box labels
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 thePMProRH_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 checkget_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 toPMProRH_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 toPMPro_Field
forget_label()