From 6b2322f11002d85e876dcf6149bd513b61a2324f Mon Sep 17 00:00:00 2001 From: minh160302 Date: Thu, 19 Mar 2026 15:41:33 +0100 Subject: [PATCH] fix(i18n): hardcoded strings in repository activity graphs (#11735) This PR removes hard-coded string from the activities page. Resolves https://codeberg.org/forgejo/forgejo/issues/11680 Co-authored-by: Minh Nguyen <44615298+minh160302@users.noreply.github.com> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Beowulf Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11735 Reviewed-by: Gusted Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Beowulf Co-authored-by: minh160302 Co-committed-by: minh160302 --- options/locale_next/locale_en-US.json | 2 ++ templates/repo/code_frequency.tmpl | 1 + templates/repo/recent_commits.tmpl | 1 + .../e2e/repo-activity-contributors.test.e2e.ts | 18 ++++++++++++++++++ web_src/js/components/RepoCodeFrequency.vue | 2 +- web_src/js/components/RepoRecentCommits.vue | 2 +- web_src/js/features/code-frequency.js | 1 + web_src/js/features/recent-commits.js | 1 + 8 files changed, 26 insertions(+), 2 deletions(-) diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json index 1a4036b79b..9db0fb67c6 100644 --- a/options/locale_next/locale_en-US.json +++ b/options/locale_next/locale_en-US.json @@ -561,5 +561,7 @@ "editor.toggle_regex": "Toggle using regular expressions", "editor.toggle_whole_word": "Toggle matching whole words", "form.RunnerName": "Name", + "graphs.recent_commits.title": "Number of commits in the past year", + "graphs.code_frequency.title": "Code frequency over the history of {0}", "meta.last_line": "Thank you for translating Forgejo! This line isn't seen by the users but it serves other purposes in the translation management. You can place a fun fact in the translation instead of translating it." } diff --git a/templates/repo/code_frequency.tmpl b/templates/repo/code_frequency.tmpl index 50ec1beb6b..e6bc097420 100644 --- a/templates/repo/code_frequency.tmpl +++ b/templates/repo/code_frequency.tmpl @@ -2,6 +2,7 @@
diff --git a/templates/repo/recent_commits.tmpl b/templates/repo/recent_commits.tmpl index 5c241d635c..b39dabdaca 100644 --- a/templates/repo/recent_commits.tmpl +++ b/templates/repo/recent_commits.tmpl @@ -2,6 +2,7 @@
diff --git a/tests/e2e/repo-activity-contributors.test.e2e.ts b/tests/e2e/repo-activity-contributors.test.e2e.ts index ece62cfaba..d9096bc8a3 100644 --- a/tests/e2e/repo-activity-contributors.test.e2e.ts +++ b/tests/e2e/repo-activity-contributors.test.e2e.ts @@ -15,3 +15,21 @@ test('Contributor graph', async ({page}) => { await page.getByRole('link', {name: '2 Commits'}).click(); await expect(page.getByRole('cell', {name: 'Bob'})).toHaveCount(2); }); + +test('Code frequency', async ({page}) => { + await page.goto('/user2/commits_search_test/activity/code-frequency'); + + /* Verify that Vue has access to i18n string */ + const header = page.locator('#repo-code-frequency-chart .header'); + await header.waitFor(); + await expect(header).toContainText('Code frequency over the history of user2/commits_search_test'); +}); + +test('Recent commits', async ({page}) => { + await page.goto('/user2/commits_search_test/activity/recent-commits'); + + /* Verify that Vue has access to i18n string */ + const header = page.locator('#repo-recent-commits-chart .header'); + await header.waitFor(); + await expect(header).toContainText('Number of commits in the past year'); +}); diff --git a/web_src/js/components/RepoCodeFrequency.vue b/web_src/js/components/RepoCodeFrequency.vue index 1d40d6d417..5aef63b0d4 100644 --- a/web_src/js/components/RepoCodeFrequency.vue +++ b/web_src/js/components/RepoCodeFrequency.vue @@ -145,7 +145,7 @@ export default {