Skip to content

Commit 212c109

Browse files
authored
fix: error messages display properly (#166)
1 parent 341c4e9 commit 212c109

5 files changed

Lines changed: 171 additions & 6 deletions

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,24 @@ npm run test:coverage
9292

9393
## Translations
9494

95-
The translations are stored on [./public/locales](./public/locales) and the English version is the source of truth. We use Transifex to help us translate WebUI to another languages.
95+
The translations are automatically handled by Vite's build process. The app uses a two-tier translation system:
96+
97+
1. **Primary translations**: Loaded from `ipld-explorer-components` package (namespace: `explore`)
98+
2. **Fallback translations**: Local translations in `./public/locales` (namespace: `app`)
99+
100+
### Automatic Translation Handling
101+
102+
Translations are automatically processed during the build:
103+
104+
- **Vite static copy**: The `viteStaticCopy` plugin automatically copies `ipld-explorer-components/dist/locales` to the build directory
105+
- **Fallback system**: The i18n configuration uses `app.json` files as fallback when primary translations fail to load
106+
- **Language detection**: The app automatically detects user language and falls back through language variants (e.g., `en-US``en`)
107+
108+
### Translation Structure
109+
110+
The build process copies `explore.json` files from `ipld-explorer-components/dist/locales/{lang}/` to `build/locales/{lang}/explore.json`, while local `app.json` files in `public/locales/{lang}/` serve as fallbacks.
111+
112+
### Contributing Translations
96113

97114
**If you're interested in contributing a translation**, go to [our page on Transifex](https://www.transifex.com/ipfs/ipfs-webui/translate/), create an account, pick a language and start translating.
98115

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"i18next-icu": "2.3.0",
2727
"i18next-localstorage-backend": "^4.2.0",
2828
"ipfs-css": "^1.3.0",
29-
"ipld-explorer-components": "^8.2.1",
29+
"ipld-explorer-components": "^8.2.2",
3030
"react": "^16.14.0",
3131
"react-dom": "^16.14.0",
3232
"react-i18next": "^15.7.3",

public/locales/ca/app.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"appName": "Explorador d'IPLD",
3+
"tabName": "Explora",
4+
"homeLink": "Inici",
5+
"UpdateAvailable": {
6+
"paragraph1": "A new version of IPLD Explorer is available; <1>please reload</1>."
7+
},
8+
"StartExploringPage": {
9+
"title": "Explora - IPLD",
10+
"header": "Explora el bosc de Merkle",
11+
"leadParagraph": "Enganxa un CID al quadre de text per trobar el node IPLD al que es refereix, o tria un conjunt de dades acceptat.",
12+
"noDataAvailable": "No hi ha dades disponibles"
13+
},
14+
"AboutIpld": {
15+
"paragraph1": "<0>IPLD is <1>the data model of the content-addressable web.</1> It allows us to treat all hash-linked data structures as subsets of a unified information space, unifying all data models that link data with hashes as instances of IPLD.</0>",
16+
"paragraph2": "<0>Content addressing through hashes has become a widely-used means of connecting data in distributed systems, from the blockchains that run your favorite cryptocurrencies, to the commits that back your code, to the web’s content at large. Yet, whilst all of these tools rely on some common primitives, their specific underlying data structures are not interoperable.</0>",
17+
"paragraph3": "<0>Enter IPLD: a single namespace for all hash-inspired protocols. Through IPLD, links can be traversed across protocols, allowing you to explore data regardless of the underlying protocol.</0>"
18+
},
19+
"ExplorePage": {
20+
"title": "Explorant - IPLD"
21+
},
22+
"IpldExploreForm": {
23+
"explore": "Explora"
24+
},
25+
"IpldCarExploreForm": {
26+
"imports": "Importa",
27+
"uploadCarFile": "Upload CAR File"
28+
},
29+
"CidInfo": {
30+
"header": "Info del CID",
31+
"hashDigest": "Hash digest"
32+
},
33+
"ObjectInfo": {
34+
"publicGateway": "View on Public Gateway",
35+
"privateGateway": "View on Local Gateway"
36+
},
37+
"base": "base",
38+
"version": "versió",
39+
"codec": "codec",
40+
"multihash": "multihash",
41+
"tour": {
42+
"projects": {
43+
"title": "Conjunt de dades acceptats",
44+
"paragraph1": "Explore the featured datasets or paste a CID to see how that data is structured and linked across protocols."
45+
},
46+
"explorer": {
47+
"step1": {
48+
"title": "Explorador d'IPLD",
49+
"paragraph1": "Your journey with IPLD Explorer starts here. Click \"Next\" to learn more."
50+
},
51+
"step2": {
52+
"title": "Ruta de navegació",
53+
"paragraph1": "The path that leads to this node.",
54+
"paragraph2": "Click on it to traverse to its parents or children."
55+
},
56+
"step3": {
57+
"title": "Info del node",
58+
"paragraph1": "Aquí tens informació detallada sobre el node i el pots obrir al getaway d'IPFS.",
59+
"paragraph2": "Si el node és un directori pots veure i navegar en els seus fills."
60+
},
61+
"step4": {
62+
"title": "Info del CID",
63+
"paragraph1": "El CID descomposat per tal que puguins aprendre el seu significat."
64+
},
65+
"step5": {
66+
"title": "Representació visual",
67+
"paragraph1": "Una representació visual del node i els seus fills."
68+
}
69+
}
70+
},
71+
"errors": {
72+
"BlockFetchTimeoutError": "Failed to fetch content in {timeout}s. Please refresh the page to retry or try a different CID."
73+
}
74+
}

public/locales/zh-TW/app.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"appName": "IPLD 瀏覽器",
3+
"tabName": "瀏覽",
4+
"homeLink": "首頁",
5+
"UpdateAvailable": {
6+
"paragraph1": "A new version of IPLD Explorer is available; <1>please reload</1>."
7+
},
8+
"StartExploringPage": {
9+
"title": "瀏覽 - IPLD",
10+
"header": "瀏覽Merkle森林",
11+
"leadParagraph": "Paste a CID into the box to fetch the IPLD node it addresses, or choose a featured dataset.",
12+
"noDataAvailable": "沒有可用數據"
13+
},
14+
"AboutIpld": {
15+
"paragraph1": "<0>IPLD is <1>the data model of the content-addressable web.</1> It allows us to treat all hash-linked data structures as subsets of a unified information space, unifying all data models that link data with hashes as instances of IPLD.</0>",
16+
"paragraph2": "<0>Content addressing through hashes has become a widely-used means of connecting data in distributed systems, from the blockchains that run your favorite cryptocurrencies, to the commits that back your code, to the web’s content at large. Yet, whilst all of these tools rely on some common primitives, their specific underlying data structures are not interoperable.</0>",
17+
"paragraph3": "<0>Enter IPLD: a single namespace for all hash-inspired protocols. Through IPLD, links can be traversed across protocols, allowing you to explore data regardless of the underlying protocol.</0>"
18+
},
19+
"ExplorePage": {
20+
"title": "瀏覽 - IPLD"
21+
},
22+
"IpldExploreForm": {
23+
"explore": "瀏覽"
24+
},
25+
"IpldCarExploreForm": {
26+
"imports": "匯入",
27+
"uploadCarFile": "Upload CAR File"
28+
},
29+
"CidInfo": {
30+
"header": "CID info",
31+
"hashDigest": "雜湊摘要"
32+
},
33+
"ObjectInfo": {
34+
"publicGateway": "View on Public Gateway",
35+
"privateGateway": "View on Local Gateway"
36+
},
37+
"base": "基礎",
38+
"version": "版本",
39+
"codec": "編解碼器",
40+
"multihash": "多重雜湊",
41+
"tour": {
42+
"projects": {
43+
"title": "Featured datasets",
44+
"paragraph1": "Explore the featured datasets or paste a CID to see how that data is structured and linked across protocols."
45+
},
46+
"explorer": {
47+
"step1": {
48+
"title": "IPLD 瀏覽器",
49+
"paragraph1": "Your journey with IPLD Explorer starts here. Click \"Next\" to learn more."
50+
},
51+
"step2": {
52+
"title": "導覽列",
53+
"paragraph1": "The path that leads to this node.",
54+
"paragraph2": "Click on it to traverse to its parents or children."
55+
},
56+
"step3": {
57+
"title": "節點信息",
58+
"paragraph1": "Here you have detailed info about the node and you can open it in the IPFS gateway.",
59+
"paragraph2": "If the node is a directory you can see its children and navigate to them."
60+
},
61+
"step4": {
62+
"title": "CID info",
63+
"paragraph1": "The decomposed CID so you can learn its meaning."
64+
},
65+
"step5": {
66+
"title": "Visual representation",
67+
"paragraph1": "A visual representation of the node and its children."
68+
}
69+
}
70+
},
71+
"errors": {
72+
"BlockFetchTimeoutError": "Failed to fetch content in {timeout}s. Please refresh the page to retry or try a different CID."
73+
}
74+
}

0 commit comments

Comments
 (0)