Skip to content

Commit 4f9d217

Browse files
brunoborgesCopilot
andcommitted
Fix translation issue template to support URL pre-fill
- Change locale and area fields from dropdown to input type (GitHub only supports pre-filling input/textarea via URL params) - Simplify pre-filled URL values for locale and area fields Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2843133 commit 4f9d217

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

.github/ISSUE_TEMPLATE/translation-issue.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,21 @@ body:
1212
Found a mistranslation, awkward phrasing, or missing translation?
1313
Let us know and we'll fix it.
1414
15-
- type: dropdown
15+
- type: input
1616
id: locale
1717
attributes:
1818
label: Language
19-
description: "Which language has the issue?"
20-
options:
21-
- de — Deutsch
22-
- es — Español
23-
- pt-BR — Português (Brasil)
24-
- zh-CN — 中文 (简体)
25-
- ar — العربية
26-
- fr — Français
27-
- ja — 日本語
28-
- ko — 한국어
19+
description: "Which language has the issue? (e.g. de, es, pt-BR, zh-CN, ar, fr, ja, ko)"
20+
placeholder: "pt-BR"
2921
validations:
3022
required: true
3123

32-
- type: dropdown
24+
- type: input
3325
id: area
3426
attributes:
3527
label: What is affected?
36-
description: "Is this about a pattern page or the site UI (nav, buttons, labels)?"
37-
options:
38-
- Pattern content (title, summary, explanation, etc.)
39-
- UI strings (navigation, buttons, labels, footer)
28+
description: "Pattern content or UI strings (navigation, buttons, labels, footer)?"
29+
placeholder: "Pattern content"
4030
validations:
4131
required: true
4232

html-generators/generate.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,13 @@ Map<String, String> buildContributeUrls(Snippet s, String locale, String localeN
427427
var codeBody = urlEncode("**Pattern:** %s\n**URL:** %s\n\nDescribe the issue:\n".formatted(s.slug(), pageUrl));
428428
var codeUrl = "%s?title=%s&labels=%s&body=%s".formatted(GITHUB_ISSUES_URL, codeTitle, "bug", codeBody);
429429

430-
var transUrl = "%s?template=translation-issue.yml&title=%s".formatted(
431-
GITHUB_ISSUES_URL, urlEncode("[Translation] %s (%s)".formatted(s.title(), localeName)));
430+
var cleanLocaleName = localeName.replaceFirst("^[^\\p{L}]+", "");
431+
var transUrl = "%s?template=translation-issue.yml&title=%s&locale=%s&pattern=%s&area=%s".formatted(
432+
GITHUB_ISSUES_URL,
433+
urlEncode("[Translation] %s (%s)".formatted(s.title(), cleanLocaleName)),
434+
urlEncode(locale),
435+
urlEncode(s.slug()),
436+
urlEncode("Pattern content"));
432437

433438
var suggestUrl = "%s?template=new-pattern.yml".formatted(GITHUB_ISSUES_URL);
434439

0 commit comments

Comments
 (0)