Skip to content

Commit

Permalink
feat: default localization from browser navigator (#1260)
Browse files Browse the repository at this point in the history
We now have everything translated, lets default it:
```
Catalog statistics for src/locales/{locale}: 
┌─────────────┬─────────────┬─────────┐
│ Language    │ Total count │ Missing │
├─────────────┼─────────────┼─────────┤
│ en (source) │     652     │    -    │
│ es          │     652     │    0    │
│ pt          │     652     │    0    │
│ test        │     615     │   615   │
└─────────────┴─────────────┴─────────┘
```

---


https://github.com/user-attachments/assets/ff6402d7-ceed-44f3-ac5f-a49e4021afad
  • Loading branch information
IanKrieger authored Jul 19, 2024
1 parent 1b7b3d4 commit cfa3e65
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function LaunchCampaignButton() {
trackMatomoEvent("basic-attention-token", "launch-campaign")
}
sx={{
width: "250px",
width: "300px",
maxHeight: { xs: "40px", md: "60px" },
mb: 1,
fontSize: "16px",
Expand Down
4 changes: 2 additions & 2 deletions src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { detect, fromUrl } from "@lingui/detect-locale";
import { detect, fromNavigator, fromUrl } from "@lingui/detect-locale";
import { enUS, esES, ptBR } from "@mui/x-data-grid/locales";

import benefits from "@/assets/images/ad-benefits.svg";
Expand Down Expand Up @@ -27,7 +27,7 @@ export function findLocale() {
let gridTheme = enUS;
let images = { benefits };

const detectedLocale = detect(fromUrl("lang") /*fromNavigator(), */);
const detectedLocale = detect(fromUrl("lang"), fromNavigator());

if (detectedLocale) {
const matchedLocale = locales.find((l) =>
Expand Down
24 changes: 12 additions & 12 deletions src/locales/en.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/locales/es.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cfa3e65

Please sign in to comment.