Skip to content

Commit 55b724d

Browse files
authored
Release v4.1.0: shared products navigation refactor (#1272)
* Refine products navigation and redirects * Update navigation titles and add new links for Solana products * Update pnpm-lock and package dependencies; refactor header components for improved navigation - Updated turbo version to 2.8.20 in pnpm-lock.yaml. - Added vitest as a dev dependency in ui-chrome package. - Refactored header components to utilize NavItemsList and SectionHeading for better structure and maintainability. - Removed unused imports and simplified navigation logic across various header lists. * Fix shared header section typing * refactor: centralize i18n catalogs in workspace package * chore(i18n): update internationalization scripts and remove deprecated message files - Added new i18n audit and prune scripts to package.json for better message management. - Removed unused i18n message files for 'breakpoint' and 'docs' in multiple languages to streamline the localization process. - Updated test cases to reflect changes in message structure and ensure accurate locale handling. * chore(i18n): update Lingo command and restructure i18n configuration - Changed the Lingo command in package.json to use 'run' instead of 'i18n' for better clarity. - Updated README.md to reflect changes in command usage and terminology from 'bucket' to 'catalog'. - Modified i18n.json to rename the 'web' bucket to 'json' and consolidate message file paths for improved organization. - Enhanced the run.mjs script to support dynamic catalog paths for better maintainability. * chore(i18n): update translations and streamline message structure - Removed deprecated titles from multiple language files, including "Authorized Environments," "Real-World Assets," "Actions and Blockchain Links," and "Wallets." - Added new title "Tokens" to enhance clarity in the DAOs section across various languages. - Consolidated button and list item structures for improved consistency in the user interface. - Updated case study labels and video headings for better localization and user experience. * test(i18n): update test case to load Swedish locale messages - Modified the test case to load messages for the Swedish locale instead of French, ensuring accurate fallback behavior to English for missing locale files. * Fix shared locale persistence across apps * Fix immutable redirect headers in i18n middleware * chore(i18n): clear out all language files for media messages - Removed all existing translations from media message files across multiple languages, resulting in empty JSON objects. - This change prepares for a fresh update of translations to ensure consistency and accuracy in future localization efforts. * chore(i18n): update translations for solutions and resources across multiple languages - Changed the title from "Solutions" to "Products" in the solutions section for consistency. - Updated tool titles to reflect more accurate descriptions, such as changing "Token Extensions" to "Token Extensions" and "Payment Tools" to "Payment Tools." - Modified resource titles to "External Resources" and added new items like "Payments.org," "Solana Launch," and "Solana Mobile" across all language files for improved clarity and relevance.
1 parent d15854a commit 55b724d

146 files changed

Lines changed: 3695 additions & 9594 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LINGODOTDEV_API_KEY=your_lingo_api_key_here
2+
# Preferred by newer Lingo CLI versions. Keep both set locally if you want to avoid deprecation warnings.
3+
LINGO_API_KEY=your_lingo_api_key_here

.github/workflows/i18n.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@ on:
44
push:
55
branches:
66
- main
7+
workflow_dispatch:
8+
inputs:
9+
target:
10+
description: Translation scope to run
11+
required: true
12+
default: all
13+
type: choice
14+
options:
15+
- all
16+
- ui
17+
- docs
718

819
permissions:
920
contents: write
1021
pull-requests: write
1122

1223
jobs:
13-
i18n-web:
14-
name: Run i18n for web (UI strings)
24+
i18n-ui:
25+
name: Run i18n for shared UI catalogs
26+
if: github.event_name == 'push' || github.event.inputs.target == 'all' || github.event.inputs.target == 'ui'
1527
runs-on: ubuntu-latest
1628
steps:
1729
- uses: actions/checkout@v4
@@ -21,13 +33,14 @@ jobs:
2133
with:
2234
api-key: ${{ secrets.LINGODOTDEV_API_KEY }}
2335
pull-request: true
24-
pull-request-title: "i18n: Lingo (web)"
25-
commit-message: "i18n: Lingo Translation Update (web)"
26-
working-directory: "apps/web"
36+
pull-request-title: "i18n: Lingo (ui)"
37+
commit-message: "i18n: Lingo Translation Update (ui)"
38+
working-directory: "packages/i18n"
2739
parallel: true
2840

2941
i18n-docs:
30-
name: Run i18n for docs (content)
42+
name: Run i18n for docs content
43+
if: github.event_name == 'push' || github.event.inputs.target == 'all' || github.event.inputs.target == 'docs'
3144
runs-on: ubuntu-latest
3245
steps:
3346
- uses: actions/checkout@v4
@@ -41,19 +54,3 @@ jobs:
4154
commit-message: "i18n: Lingo Translation Update (docs)"
4255
working-directory: "apps/docs"
4356
parallel: true
44-
45-
i18n-accelerate:
46-
name: Run i18n for accelerate (UI strings)
47-
runs-on: ubuntu-latest
48-
steps:
49-
- uses: actions/checkout@v4
50-
- uses: lingodotdev/lingo.dev@main
51-
env:
52-
GH_TOKEN: ${{ github.token }}
53-
with:
54-
api-key: ${{ secrets.LINGODOTDEV_API_KEY }}
55-
pull-request: true
56-
pull-request-title: "i18n: Lingo (accelerate)"
57-
commit-message: "i18n: Lingo Translation Update (accelerate)"
58-
working-directory: "apps/accelerate"
59-
parallel: true

apps/accelerate/i18n.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/accelerate/i18n.lock

Lines changed: 0 additions & 171 deletions
This file was deleted.

apps/accelerate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "eslint .",
1010
"lint:fix": "eslint --fix .",
1111
"check-types": "tsc --noEmit",
12-
"i18n:lingo": "npx lingo.dev@latest i18n",
12+
"i18n:lingo": "pnpm --dir ../.. i18n:app accelerate",
1313
"sync:sponsors": "tsx scripts/sync-sponsors.ts",
1414
"sync:speakers": "tsx scripts/sync-speakers.ts",
1515
"clean": "rm -rf node_modules .next"

apps/accelerate/src/app/[locale]/layout.tsx

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,14 @@ import Script from "next/script";
33
import { NextIntlClientProvider, AbstractIntlMessages } from "next-intl";
44
import { ThemeProvider } from "@solana-com/ui-chrome";
55
import { staticLocales } from "@workspace/i18n/config";
6+
import { loadMergedMessages } from "@workspace/i18n/messages";
67
import { getLangDir } from "rtl-detect";
78
import { Space_Grotesk } from "next/font/google";
89
import localFont from "next/font/local";
910
import { getBaseMetadata } from "../metadata";
1011
import "@@/src/scss/index.scss";
1112
import "../globals.css";
1213

13-
const enMessages: AbstractIntlMessages = (
14-
await import("../../../public/locales/en/common.json")
15-
).default;
16-
17-
/** Deep-merge locale messages on top of English so missing keys fall back to English. */
18-
function deepMerge(
19-
base: AbstractIntlMessages,
20-
override: AbstractIntlMessages,
21-
): AbstractIntlMessages {
22-
const result: AbstractIntlMessages = { ...base };
23-
for (const key of Object.keys(override)) {
24-
const bVal = base[key];
25-
const oVal = override[key];
26-
if (
27-
bVal &&
28-
oVal &&
29-
typeof bVal === "object" &&
30-
typeof oVal === "object" &&
31-
!Array.isArray(bVal) &&
32-
!Array.isArray(oVal)
33-
) {
34-
result[key] = deepMerge(
35-
bVal as AbstractIntlMessages,
36-
oVal as AbstractIntlMessages,
37-
);
38-
} else if (oVal !== undefined) {
39-
// Don't let a stale primitive overwrite a structured English object
40-
if (typeof bVal === "object" && typeof oVal !== "object") continue;
41-
result[key] = oVal;
42-
}
43-
}
44-
return result;
45-
}
46-
4714
// Load Space Grotesk font from Google Fonts
4815
const spaceGrotesk = Space_Grotesk({
4916
subsets: ["latin"],
@@ -127,17 +94,10 @@ export async function generateMetadata({ params }: Props) {
12794
export default async function RootLayout({ children, params }: Props) {
12895
const { locale = "en" } = await params;
12996
const direction = getLangDir(locale);
130-
let messages = enMessages;
131-
if (locale !== "en") {
132-
try {
133-
const localeMessages: AbstractIntlMessages = (
134-
await import(`../../../public/locales/${locale}/common.json`)
135-
).default;
136-
messages = deepMerge(enMessages, localeMessages);
137-
} catch {
138-
// Locale file doesn't exist — fall back to English
139-
}
140-
}
97+
const messages = (await loadMergedMessages({
98+
app: "accelerate",
99+
locale,
100+
})) as AbstractIntlMessages;
141101

142102
return (
143103
<html

apps/accelerate/src/i18n/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# i18n
22

33
Translations are generated during CI/CD via `.github/workflows/i18n.yml` using
4-
[Lingo](https://lingo.dev). The app uses next-intl with JSON message files in
5-
`public/locales/[locale]/common.json`.
4+
[Lingo](https://lingo.dev). The app uses next-intl with shared JSON message
5+
files in `packages/i18n/messages/accelerate/[locale]/common.json`.
66

77
## Manual gen i18n
88

99
Translations can be manually triggered:
1010

1111
- run `npx lingo.dev@latest login` to login to Lingo
12-
- run `pnpm i18n:lingo` (or `npx lingo.dev@latest i18n` from `apps/accelerate`)
12+
- run `pnpm i18n:lingo` from `apps/accelerate`
13+
- or run `pnpm i18n:app accelerate` from repo root

0 commit comments

Comments
 (0)