• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

agama-project / agama / 20262368863
73%

Build:
DEFAULT BRANCH: master
Ran 16 Dec 2025 09:09AM UTC
Jobs 3
Files 585
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Dec 2025 09:06AM UTC coverage: 68.409% (+4.3%) from 64.15%
20262368863

push

github

web-flow
web: added TranslatedString type (#2928)

## Problem

- We already check that the React components for untranslated string
literals, e.g. `<Button>Close</Button>` reports an error in the eslint
check.
- Unfortunately it cannot check the texts passed as a component
attribute, e.g. `<Button label="Close" />`

## Solution

- Use the [type-fest](https://www.npmjs.com/package/type-fest) library,
it provides quite a lot of useful TypeScript types
- Inspired by [this blog post
article](https://idmontie.github.io/blog/post/2023-08-19-localization)
- Define a new `TranslatedString` type which holds a translated string
(a string which passed through the `_()` or `n_()` translation
functions)
- Require this new type in some core components
- Passing a plain string where a TranslatedString is expected results in
a type error reported by TypeScript.

## Testing

- Updated unit tests

Tested with this small code snippet:
```tsx
function foo(label: TranslatedString) {
  return <>{label}</>;
}
// this line fails the type check
foo("label");
```

The last line in the example fails with error "Argument of type 'string'
is not assignable to parameter of type 'TranslatedString'.
  Type 'string' is not assignable to type 'Tag<"Translated", never>'."

## Notes

- The texts marked for translation in the unit tests are ignored when
building the POT file. Those strings are not uploaded to Weblate.

## Performance impact

The input TypeScript source code
```tsx
function foo(label: TranslatedString) {
  return <>{label}</>;
}
function bar() {
  return foo(_("label"));
}
```

Is compiled into this JavaScript:

```js
function foo(label) {
    return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: label });
}
function bar() {
    return foo((0, i18n_1._)("label"));
}
```

As you can see there is zero overhead for the `TranslatedString` type,
the check is completely done at the compile time without any performance
effect at runtime.

2695 of 4728 branches covered (57.0%)

Branch coverage included in aggregate %.

17 of 18 new or added lines in 13 files covered. (94.44%)

12 existing lines in 3 files now uncovered.

12158 of 16984 relevant lines covered (71.59%)

71.56 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
92.86
0.0% web/src/components/users/PasswordCheck.tsx

Uncovered Existing Lines

Lines Coverage ∆ File
1
80.0
0.0% web/web/src/components/core/MenuHeader.tsx
5
74.29
0.0% web/web/src/components/core/TreeTable.tsx
6
50.0
0.0% web/web/src/i18n.ts
Subprojects
ID Flag name Job ID Ran Files Coverage
3 web 20262368863.3 16 Dec 2025 09:09AM UTC 585
68.41
GitHub Action Run
1 rust 19474749743.1 18 Nov 2025 05:18PM UTC 185
22.45
GitHub Action Run
3 service 20159186342.3 12 Dec 2025 07:13AM UTC 390
88.58
GitHub Action Run
Source Files on build 20262368863
  • Tree
  • List 585
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #20262368863
  • ee705f2a on github
  • Prev Build on master (#20159186342)
  • Next Build on master (#20295174843)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc