0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-04 03:21:41 +02:00
Nicolas a342206a21
fix(locales): Replace hardcoded strings (#37788)
The Workflow Dependencies graph in the Actions run details view had
hard-coded English strings.
Also in projects view and contributors view I found some hard-coded
strings.
  
The other items in the issue #37787 (Summary / All jobs / Run Details /
Workflow file / Triggered via / Total duration) were already wired
through ctx.Locale.Tr; their translations just need to land in the
non-English locale_*.json files via the translation pipeline.



Fixes #37787

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.8) <noreply@anthropic.com>
2026-05-29 23:50:55 +00:00

8 lines
355 B
TypeScript

import {getCurrentLocale} from '../utils.ts';
/** frontend `Locale.TrN`: pick the `_1` or `_n` form for `count` and interpolate `%d` */
export function trN(count: number, form1: string, formN: string): string {
const form = new Intl.PluralRules(getCurrentLocale()).select(count) === 'one' ? form1 : formN;
return form.replace('%d', String(count));
}