Skip to content

Commit

Permalink
🐛(lld): missing translations for network troubleshooting (#8337)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey authored Nov 8, 2024
1 parent 25c53f1 commit be27e15
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/shaggy-shoes-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"@ledgerhq/live-common": patch
---

Add translation for troubleshooting network
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@ const Status = ({ status }: { status?: TroubleshootStatus }) => {
}
};
const RenderState = ({ state }: { state: TroubleshootStatus[] }) => {
const { t } = useTranslation();
return (
<Table>
<thead>
<tr>
<th>TEST</th>
<th>RENDERER</th>
<th>{t("troubleshootNetwork.test")}</th>
<th>{t("troubleshootNetwork.renderer")}</th>
</tr>
</thead>
<tbody>
{state.map(status => {
return (
<tr key={status.title}>
<td>{status.title}</td>
<td>{t(status.translationKey)}</td>
<td>
<Status status={status} />
</td>
Expand Down
12 changes: 10 additions & 2 deletions apps/ledger-live-desktop/static/i18n/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2375,7 +2375,7 @@
"footer": {
"estimatedFees": "Network fees"
},
"info":{
"info": {
"needMemoTag": {
"title": "Don’t use Tag/Memo?",
"description": "Your funds will get lost if you don’t add a Tag/Memo when sending them to any centralized exchange or custodial wallet.",
Expand All @@ -2390,7 +2390,15 @@
"version": "Ledger Live {{versionNb}}"
},
"troubleshootNetwork": {
"title": "Troubleshoot networking"
"title": "Troubleshoot networking",
"myLedgerServices": "My Ledger services (scriptrunner)",
"bitcoinExplorers": "Bitcoin explorers",
"ethereumExplorers": "Ethereum explorers",
"countervaluesApi": "Countervalues API",
"announcements": "Announcements",
"status": "Status",
"test": "TEST",
"renderer": "RENDERER"
},
"systemLanguageAvailable": {
"title": "Change your app's language?",
Expand Down
11 changes: 11 additions & 0 deletions libs/ledger-live-common/src/network-troubleshooting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ export type TroubleshootStatus = {
technicalDescription: string;
status: "success" | "error" | "loading";
error?: string;
translationKey: string;
};

type Troubleshoot = {
title: string;
technicalDescription: string;
job: Promise<unknown>;
translationKey: string;
};

// Run all checks and return. each troubleshoot have a promise that suceed if the underlying job worked.
Expand All @@ -25,6 +27,7 @@ export function troubleshoot(): Troubleshoot[] {
return [
{
title: "My Ledger services (scriptrunner)",
translationKey: "troubleshootNetwork.myLedgerServices",
...websocketConnects(
`${getEnv(
"BASE_SOCKET_URL",
Expand All @@ -33,23 +36,28 @@ export function troubleshoot(): Troubleshoot[] {
},
{
title: "Bitcoin explorers",
translationKey: "troubleshootNetwork.bitcoinExplorers",
...httpGet(getEnv("EXPLORER") + "/blockchain/v4/btc/block/current"),
},
{
title: "Ethereum explorers",
translationKey: "troubleshootNetwork.ethereumExplorers",
...httpGet(getEnv("EXPLORER") + "/blockchain/v4/eth/block/current"),
},
{
title: "Countervalues API",
translationKey: "troubleshootNetwork.countervaluesApi",
...httpGet(`${getEnv("LEDGER_COUNTERVALUES_API")}/v3/spot/simple?froms=bitcoin&to=eur`),
},
{
title: "Announcements",
translationKey: "troubleshootNetwork.announcements",
technicalDescription: "fetching announcements",
job: announcementsApi.fetchAnnouncements(),
},
{
title: "Status",
translationKey: "troubleshootNetwork.status",
technicalDescription: "fetching status",
job: serviceStatusApi.fetchStatusSummary(),
},
Expand Down Expand Up @@ -106,6 +114,7 @@ export function troubleshootOverObservable(): Observable<TroubleshootEvent> {
type: "init",
all: all.map(s => ({
title: s.title,
translationKey: s.translationKey,
technicalDescription: s.technicalDescription,
status: "loading",
})),
Expand All @@ -120,6 +129,7 @@ export function troubleshootOverObservable(): Observable<TroubleshootEvent> {
type: "change",
status: {
title: s.title,
translationKey: s.translationKey,
technicalDescription: s.technicalDescription,
status: "success",
},
Expand All @@ -130,6 +140,7 @@ export function troubleshootOverObservable(): Observable<TroubleshootEvent> {
type: "change",
status: {
title: s.title,
translationKey: s.translationKey,
technicalDescription: s.technicalDescription,
status: "error",
error: String(e?.message || e),
Expand Down

0 comments on commit be27e15

Please sign in to comment.