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 creating/editing array language variables with using new entries field #7011

Open
wants to merge 2 commits into
base: v5/develop
Choose a base branch
from

Conversation

afbora
Copy link
Member

@afbora afbora commented Feb 15, 2025

Description

v5-develop test_panel_languages_en

Open question

  • Decide Kirby release, 5.0? 5.1?
  • Need help to improve labels and help texts (Would be great dynamic placeholder, but AFAIK not available for now such a feature)

Changelog

Features

  • Now array language variables can be created/edited from panel

Breaking changes

None

Docs

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and CI checks all pass

For review team

  • Add lab and/or sandbox examples (wherever helpful)
  • Add changes & docs to release notes draft in Notion

@afbora afbora added needs: decision 🗳 Requires a decision to proceed needs: tests 🧪 Requires missing tests labels Feb 15, 2025
@afbora afbora requested review from a team February 15, 2025 21:40
@afbora afbora self-assigned this Feb 15, 2025
Comment on lines +452 to +453
"language.variable.entries": "Entries",
"language.variable.entries.help": "This strings will be used for translations count. Each entry corresponds to a different case counter. For example: 0, 1, 2 and more",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be more fitting with the existing language.variable.value:

Suggested change
"language.variable.entries": "Entries",
"language.variable.entries.help": "This strings will be used for translations count. Each entry corresponds to a different case counter. For example: 0, 1, 2 and more",
"language.variable.values": "Values",
"language.variable.values.help": "These values will be used according to the translation count. Each entry corresponds to a different case, e.g. for 0, for 1, for 2 and more.",

"language.variable.key": "Key",
"language.variable.multiple": "Multiple",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"language.variable.multiple": "Multiple",
"language.variable.multiple": "Different strings based on count",

Not so happy with this either. But I think the multiple field needs more explanatory label and maybe also on/off texts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. I'm not happy with the labels and help texts either. That's why I mentioned it in the PR description. It needs to be more descriptive and clear.

@@ -45,6 +45,12 @@ export default {
mixins: [props],
emits: ["input", "submit"],
computed: {
formValue() {
return {
...this.$helper.field.form(this.fields),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why is this needed?

Copy link
Member Author

@afbora afbora Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question.

For this line:
https://github.com/getkirby/kirby/blob/lab/afbora/support-array-language-variables/config/areas/languages/dialogs.php#L55

Otherwise default value of multiple field is null. We have two condition fields value and entries. When multiple disabled value field visible and when enabled entries field visible. So when multiple value is null, no fields visible.

Not sure this is a correct solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we don't use default there but rather add here https://github.com/getkirby/kirby/blob/lab/afbora/support-array-language-variables/config/areas/languages/dialogs.php#L202-L205 something like

'value' => [
  'multiple' => false
]

Copy link
Member Author

@afbora afbora Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems to be working.

What I'm wondering is; does this change I made really solve the problem of default values ​​in dialogs? Maybe we can use it in other dialogs or in the future.

If my solution is correct I would prefer the method where the fields work exactly as intended. Otherwise I'm fine with your solution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: decision 🗳 Requires a decision to proceed needs: tests 🧪 Requires missing tests
Development

Successfully merging this pull request may close these issues.

2 participants