Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

feat: Locales

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 3, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

selector = forms.TextInputField(_('Web knowledge selector'), required=False,attrs={'placeholder': _('The default is body, you can enter .classname/#idname/tagname')})


def get_collect_handler():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To address the provided Python code snippet, I have the follow points:

  1. Translation: The gettext function is used to translate placeholder texts, which improves readability and maintainability.

Optimizations

  1. Placeholder Text: For better clarity, it's good practice to provide meaningful placeholders directly within Django form fields instead of setting them in attributes outside the field definition.

Here's an optimized version of the code:

@@ -19,8 +19,6 @@
 
 class BaseDataSourceWebNodeForm(forms.Form):
     # Title translation using gettext
     title_translated = _("Base DataSource Web Node Form")
     
     source_url = forms.CharField(
         label=_("Web source url"),
         max_length=512,
         required=True,
     )
 
     selector = forms.CharField(
         label=_("Web knowledge selector"),
         max_length=255,
         required=False,
         placeholder=_("Default is 'body'; enter '.classname/#idname/tagname'"),
     )

def get_collect_handler():

In this updated version:

  • A general title for the form (title_translated) is added for context when dealing with multiple similar forms in templates.
  • Placeholder text is included directly within the widget configuration without needing additional attribute settings.

@zhanweizhang7 zhanweizhang7 merged commit fb2c1b0 into v2 Dec 3, 2025
4 of 6 checks passed
@zhanweizhang7 zhanweizhang7 deleted the pr@v2@feat_locales branch December 3, 2025 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants