Problem/Motivation

Hello,

Maybe I missed something but for settings with a defined options list like checkboxes, select. The options label is not translatable.

Command icon 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

Grimreaper created an issue. See original summary.

christian.wiedemann’s picture

I 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?

christian.wiedemann’s picture

Status: Active » Needs work
grimreaper’s picture

Thanks 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.

lbonfioli made their first commit to this issue’s fork.

gersonjl’s picture

Assigned: Unassigned » gersonjl

I'll work on this.

gersonjl’s picture

Assigned: gersonjl » Unassigned
adaucyj’s picture

Assigned: Unassigned » adaucyj

I'll work on it.

adaucyj’s picture

StatusFileSize
new30.83 KB
new61.21 KB
new35.63 KB
new954 bytes

Considering 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.

adaucyj’s picture

Assigned: adaucyj » Unassigned
Status: Needs work » Needs review
christian.wiedemann’s picture

Hi, 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.

christian.wiedemann’s picture

Status: Needs review » Needs work