However, once I’ve saved, all checkboxes are selected and can only be deselected together
Ahh, you’re right. The value is not unserialized from the database. I’ve filed an issue to fix this: Can't use array values in theme options · Issue #6184 · pkp/pkp-lib · GitHub.
As for the other question about using text area fields with different languages in the theme settings it doesn’t work (unfortunately).
I forgot to mention that you need to provide localized options. So your option set should look like this (depending on your locales):
$this->addOption('test', 'FieldOptions', [
'label' => 'test',
'isMultilingual' => true,
'options' => [
'en_US' => [
[
'value' => 1,
'label' => 'test1'
],
[
'value' => 2,
'label' => 'test2'
],
],
'fr_CA' => [
[
'value' => 1,
'label' => 'test1fr'
],
[
'value' => 2,
'label' => 'test2fr'
],
],
],
'default' => [],
]);
This is not used very much, and there are going to be some issues with getting it to be generic no matter what languages are available. If you’re working with a constricted language set, you may be able to just specify them manually.
Otherwise, it might be worth thinking about an alternate approach. That’s because the multilingual feature was really designed for entering different text, rather than choosing different options. For example, you could add a separate option for each language (eg - my-option-en_US
and my-option-fr_CA
) and that approach might work better.