Refactor new-branch form errors to be translatable
Summary
In !152122 (merged), a community contributor revised app/assets/javascripts/new_branch_form.js
to make the error messages friendlier. However, the implementation of the error messages shown in the browser is wrong. They are (untranslatable) English partial phrases that, put together, create full sentences.
(I've marked this as a bug. I'm not sure that's right.)
- Related to Updated error text for incorrect branch name wh... (!152122 - merged)
- Related to Added highlighting of incorrect branch name on ... (!151690 - merged)
- Related to Follow-up from "Added highlighting of incorrect... (#460519 - closed)
Improvements
- Refactor
setupRestrictions()
to provide complete strings, rather than partial strings that are combined together to form a sentence. - Make the strings translatable.
- Possible extra credit: as branch names can have multiple problems, consider using an unordered list to show multiple problems. Otherwise, as @annabeldunstone pointed out, you could have several sentences strung together, like this:
Risks
TBD. I'm a technical writer. I have no idea.
Involved components
app/assets/javascripts/new_branch_form.js
-
spec/features/projects/branches/user_creates_branch_spec.rb
(and possibly other tests in that directory) spec/frontend/new_branch_spec.js
locale/gitlab.pot
Optional: Intended side effects
Error messages will be translatable.