Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple translations for Field and Box labels #222

Open
3 tasks
sc0ttkclark opened this issue Sep 18, 2021 · 0 comments
Open
3 tasks

Support multiple translations for Field and Box labels #222

sc0ttkclark opened this issue Sep 18, 2021 · 0 comments

Comments

@sc0ttkclark
Copy link
Contributor

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant