- {{ content_editor(form.content) }}
+ {{ content_editor(form.content, mention_rules=true) }}
diff --git a/kitsune/questions/forms.py b/kitsune/questions/forms.py
index cc0b84113b5..9d509e0357e 100644
--- a/kitsune/questions/forms.py
+++ b/kitsune/questions/forms.py
@@ -14,55 +14,75 @@
from kitsune.sumo.forms import KitsuneBaseForumForm
from kitsune.upload.models import ImageAttachment
-# labels and help text
+# unused labels and help text
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
SITE_AFFECTED_LABEL = _lazy("URL of affected site")
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
CRASH_ID_LABEL = _lazy("Crash ID(s)")
-CRASH_ID_HELP = _lazy(
- "If you submit information to Mozilla when you crash, "
- "you'll be given a crash ID which uniquely identifies "
- "your crash and lets us look at details that may help "
- "identify the cause. To find your recently submitted "
- "crash IDs, go to
about:crashes in "
- "your location bar.
Click for detailed instructions."
-)
-TROUBLESHOOTING_LABEL = _lazy("Troubleshooting Information")
-TROUBLESHOOTING_HELP = _lazy(
- "This information gives details about the "
- "internal workings of your browser that will "
- "help in answering your question."
-)
+# if you want to use the following string, update it to remove "en-US" from the link first
+# when updating, don't remove the original string, just mark it as deprecated and create a new one
+# L10n: Unused. A description of the "Crash ID(s)" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+CRASH_ID_HELP = _lazy("If you submit information to Mozilla when you crash, you'll be given a crash ID which uniquely identifies your crash and lets us look at details that may help identify the cause. To find your recently submitted crash IDs, go to
about:crashes in your location bar.
Click for detailed instructions.")
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
FREQUENCY_LABEL = _lazy("This happens")
FREQUENCY_CHOICES = [
("", ""),
+ # L10n: Unused. An option for the "This happens" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
("NOT_SURE", _lazy("Not sure how often")),
+ # L10n: Unused. An option for the "This happens" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
("ONCE_OR_TWICE", _lazy("Just once or twice")),
+ # L10n: Unused. An option for the "This happens" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
("FEW_TIMES_WEEK", _lazy("A few times a week")),
+ # L10n: Unused. An option for the "This happens" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
("EVERY_TIME", _lazy("Every time Firefox opened")),
]
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
STARTED_LABEL = _lazy("This started when...")
-TITLE_LABEL = _lazy("Subject")
-CONTENT_LABEL = _lazy("How can we help?")
-FF_VERSION_LABEL = _lazy("Firefox version")
-OS_LABEL = _lazy("Operating system")
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
PLUGINS_LABEL = _lazy("Installed plugins")
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
ADDON_LABEL = _lazy("Extension/plugin you are having trouble with")
+# L10n: Unused. A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
DEVICE_LABEL = _lazy("Mobile device")
+
+# unused labels and help text
+# L10n: A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+TROUBLESHOOTING_LABEL = _lazy("Troubleshooting Information")
+# L10n: A description of the "Troubleshooting Information" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+TROUBLESHOOTING_HELP = _lazy("This information gives details about the internal workings of your browser that will help in answering your question.")
+# L10n: A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+TITLE_LABEL = _lazy("Summarize your question")
+# L10n: A description of the "Summarize your question" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+TITLE_HELP_TEXT = _lazy("Please summarize your question in one sentence:")
+# L10n: A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+CONTENT_LABEL = _lazy("How can we help?")
+# L10n: A description of the "How can we help?" field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+CONTENT_HELP_TEXT = _lazy('Please include as much detail as possible. Also, remember to follow our
rules and guidelines.')
+# L10n: A label for a field, displayed when filing a Firefox-related question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+FF_VERSION_LABEL = _lazy("Firefox version")
+# L10n: A label for a field, displayed when filing a Thunderbird-related question form (e.g., on https://support.mozilla.org/questions/new/thunderbird/form).
+TB_VERSION_LABEL = _lazy("Thunderbird version")
+# L10n: A placeholder for the "Thunderbird version" field, displayed when filing a Thunderbird-related question form (e.g., on https://support.mozilla.org/questions/new/thunderbird/form).
+TB_VERSION_PLACEHOLDER = _lazy("e.g., 140.5.0esr, 146.1.0 release or 147.0b4")
+# L10n: A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
+OS_LABEL = _lazy("Operating system")
+# L10n: A label for a field, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
CATEGORY_LABEL = _lazy("Which topic best describes your question?")
+# L10n: A label for a checkbox, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form).
NOTIFICATIONS_LABEL = _lazy("Email me when someone answers the thread")
+# L10n: A placeholder for the "Post a Reply" editor.
REPLY_PLACEHOLDER = _lazy("Enter your reply here.")
+# L10n: A placeholder for the email field, displayed when subscribing to a question while not signed in.
EMAIL_PLACEHOLDER = _lazy("Enter your email address here.")
class EditQuestionForm(forms.ModelForm):
"""Form to edit an existing question"""
- title = forms.CharField(label=TITLE_LABEL, min_length=5)
+ title = forms.CharField(label=TITLE_LABEL, help_text=TITLE_HELP_TEXT, min_length=5)
- content = forms.CharField(label=CONTENT_LABEL, min_length=5, widget=forms.Textarea())
+ content = forms.CharField(label=CONTENT_LABEL, help_text=CONTENT_HELP_TEXT, min_length=5, widget=forms.Textarea())
class Meta:
model = Question
@@ -75,6 +95,7 @@ def __init__(self, product=None, *args, **kwargs):
form fields to include depend on the selected product/category.
"""
super().__init__(*args, **kwargs)
+ self.label_suffix = None
# Extra fields required by product/category selected
extra_fields = []
@@ -89,6 +110,13 @@ def __init__(self, product=None, *args, **kwargs):
required=False,
)
+ if "tb_version" in extra_fields:
+ self.fields["tb_version"] = forms.CharField(
+ label=TB_VERSION_LABEL,
+ required=False,
+ widget=forms.TextInput(attrs={"placeholder": TB_VERSION_PLACEHOLDER}),
+ )
+
if "os" in extra_fields:
self.fields["os"] = forms.CharField(
label=OS_LABEL,
@@ -108,8 +136,18 @@ def __init__(self, product=None, *args, **kwargs):
for field in self.fields.values():
if not field.required:
+ # L10n: A label suffix for optional fields, displayed when filing a question form (e.g., on https://support.mozilla.org/questions/new/firefox/form). The leading space must be preserved.
field.label_suffix = _lazy(" (optional):")
+ for name, field in self.fields.items():
+ if field.help_text:
+ bound = self[name]
+ bound.help_id = f"{bound.id_for_label}_help"
+ if field.widget.attrs.get("aria-describedby"):
+ field.widget.attrs["aria-describedby"] += " " + bound.help_id
+ else:
+ field.widget.attrs["aria-describedby"] = bound.help_id
+
def clean_content(self):
"""Validate that content field contains actual text, not just HTML markup."""
content = self.cleaned_data.get("content", "")
@@ -117,6 +155,7 @@ def clean_content(self):
text_only = html.unescape(text_only).strip()
if len(text_only) < 5:
+ # L10n: An error message displayed under the "How can we help?" field when filing a question form if the submitted value contains too few non-HTML symbols.
raise forms.ValidationError(_("Question content cannot be empty."))
return content
@@ -177,7 +216,8 @@ class NewQuestionForm(EditQuestionForm):
category = forms.ModelChoiceField(
label=CATEGORY_LABEL,
queryset=Topic.objects.none(),
- empty_label="Please select",
+ # L10n: A default option for dropdown menus (displayed when none of the actual options is selected).
+ empty_label=_lazy("Please select..."),
required=True,
)
@@ -275,6 +315,3 @@ def clean_email(self):
return self.cleaned_data["email"]
# Clear out the email for logged in users, we don't want to use it.
return None
-
-
-bucket_choices = [(1, "1 day"), (7, "1 week"), (30, "1 month")]
diff --git a/kitsune/questions/jinja2/questions/edit_answer.html b/kitsune/questions/jinja2/questions/edit_answer.html
index db6f73eb700..1c72963effd 100644
--- a/kitsune/questions/jinja2/questions/edit_answer.html
+++ b/kitsune/questions/jinja2/questions/edit_answer.html
@@ -49,7 +49,7 @@
{{ _('Edit an answer') }}
{{ errorlist(form) }}
- {{ content_editor(form.content) }}
+ {{ content_editor(form.content, mention_rules=true) }}
{{ attachments_form('questions.Answer', answer.pk, answer.images.all(), settings, request.user) }}
diff --git a/kitsune/questions/jinja2/questions/edit_question.html b/kitsune/questions/jinja2/questions/edit_question.html
index 06c62792a1a..830fe9e2116 100644
--- a/kitsune/questions/jinja2/questions/edit_question.html
+++ b/kitsune/questions/jinja2/questions/edit_question.html
@@ -22,6 +22,7 @@
{{ _('When editing a question, uploading new images or deleting existing ones will happen instantly.') }}
{% endblock %}
+{# L10n: A button displayed when editing an existing question. #}
{% block submit_button_value %}{{ _('Save Question') }}{% endblock %}
{% block more_submit_buttons %}
diff --git a/kitsune/questions/jinja2/questions/includes/aaq_macros.html b/kitsune/questions/jinja2/questions/includes/aaq_macros.html
index 117a54fc9b0..77fffd87d3f 100644
--- a/kitsune/questions/jinja2/questions/includes/aaq_macros.html
+++ b/kitsune/questions/jinja2/questions/includes/aaq_macros.html
@@ -2,7 +2,9 @@
{% from 'includes/common_macros.html' import featured_articles, scam_banner %}
{% macro select_product(products) -%}
+ {# L10n: A header, displayed when asking a new question (on https://support.mozilla.org/questions/new and in Premium product question forms). #}
{{ _('Contact Support') }}
+ {# L10n: A subheader, displayed when asking a new question (on https://support.mozilla.org/questions/new). #}
{{ _('Which product do you need help with?') }}
@@ -30,6 +32,7 @@
{% endfor %}
@@ -49,8 +52,10 @@
{% if step > 1 and step < 4 %}
+ {# L10n: A label, displayed in a progress bar when asking a new question (when a product is selected, e.g., on https://support.mozilla.org/questions/new/firefox). #}
{{ _('Change Product') }}
{% else %}
+ {# L10n: A label, displayed in a progress bar when asking a new question (on https://support.mozilla.org/questions/new/). #}
{{ _('Select Product') }}
{% endif %}
@@ -65,6 +70,7 @@
{% endif %}>
+ {# L10n: A label, displayed in a progress bar when asking a new question (e.g., on https://support.mozilla.org/questions/new/). #}
{{ _('Explore Solutions') }}
@@ -104,18 +110,23 @@
{% if aaq_context %}
{% if request.user.is_authenticated %}
{% if is_ticketed %}
+ {# L10n: Text for the Ask a Question CTA widget (case: Premium products; the user is signed in). #}
{{ _('Still need help? Continue to contact our support team.') }}
{% else %}
+ {# L10n: Text for the Ask a Question CTA widget (case: Freemium products; the user is signed in). #}
{{ _('Still need help? Continue to ask your question on our forums.') }}
{% endif %}
{% else %}
{% if is_ticketed %}
+ {# L10n: Text for the Ask a Question CTA widget (case: Premium products; the user is not signed in). #}
{{ _('Still need help? Sign in to contact our support team.') }}
{% else %}
+ {# L10n: Text for the Ask a Question CTA widget (case: Freemium products; the user is not signed in). #}
{{ _('Still need help? Sign in to ask your question on our forums.') }}
{% endif %}
{% endif %}
{% else %}
+ {# L10n: Text for the Ask a Question CTA widget (case: Ask-a-question workflow is not configured). #}
{{ _('Still need help? Continue to ask your question and get help.') }}
{% endif %}
@@ -135,6 +146,7 @@
"link_name": "{{ link_name }}",
"link_detail": "{{ link_detail }}"
}'>
+ {# L10n: A button. #}
{{ _('Continue')}}
@@ -153,13 +165,16 @@