Problem/Motivation
Hello,
Maybe I missed something but for settings with a defined options list like checkboxes, select. The options label is not translatable.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3280823-9_test.patch | 954 bytes | adaucyj |
| #9 | settings_pt-br.png | 35.63 KB | adaucyj |
| #9 | settings_translate.png | 61.21 KB | adaucyj |
| #9 | settings_en.png | 30.83 KB | adaucyj |
Issue fork ui_patterns_settings-3280823
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
christian.wiedemann commentedI also missed this option but I am not sure how to translate yml files in none config entities. Using drupal t() is wrong for varibales. Do you have any idea?
Comment #3
christian.wiedemann commentedComment #4
grimreaperThanks for the feedback.
Yes, currently the workaround done in our project is the t function.
No better idea yet.
Yes, it is considered a bad practice, but I think it can be justified here because the variable values is a pre-defined list (options, checkbox, select list), it can't have any possible value.
Comment #6
gersonjlI'll work on this.
Comment #7
gersonjlComment #8
adaucyjI'll work on it.
Comment #9
adaucyjConsidering what @grimreaper said at #4, I give it a try to see if to use t() function in this case would works. I tested in CheckboxesSettingType and it works as you can see at images and in the patch. If @christianwiedemann agrees, I can implement this in the other SettingType classes. If not, I thought in these two alternatives:
1. Give UI Patterns Settings the capacity to identify labels and options for different languages. It would looks like:
settings:
mycheckbox:
type: checkboxes
label: Options
label_pt-br: Opções
allow_expose: true
options:
key_1: Value 1
key_2: Value 2
options_pt-br:
key_1: Valor 1
key_2: Valor 2
2. Do something like Webform module as desmostrated in this screencast.
We can think in many others approach, but it is up to maintainers to decide if the translate functionality should be implemented in UI Patterns Settings.
Please, let me know if I should proceed implementing the t() solution.
Comment #10
adaucyjComment #11
christian.wiedemann commentedHi, sorry for the two years of no response:) We should proceed with the t() function with an context. If you have already a patch or something I am happy to review it.
Comment #12
christian.wiedemann commented