FIX: Localize text in github oneboxes (#25327)

This commit is contained in:
Jan Cernik
2024-01-19 11:26:06 -03:00
committed by GitHub
parent f4e51e0789
commit d401502834
14 changed files with 84 additions and 23 deletions

View File

@ -50,10 +50,29 @@ module Onebox
else
result["pr"] = true
end
result["i18n"] = i18n
result["i18n"]["pr_summary"] = I18n.t(
"onebox.github.pr_summary",
{
commits: result["commits"],
changed_files: result["changed_files"],
additions: result["additions"],
deletions: result["deletions"],
},
)
result
end
def i18n
{
opened: I18n.t("onebox.github.opened"),
commit_by: I18n.t("onebox.github.commit_by"),
comment_by: I18n.t("onebox.github.comment_by"),
review_by: I18n.t("onebox.github.review_by"),
}
end
def load_commit(link)
if commit_match = link.match(%r{commits/(\h+)})
load_json(