-
-
Notifications
You must be signed in to change notification settings - Fork 44
feat: localization #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlejandroAkbal
wants to merge
33
commits into
main
Choose a base branch
from
i18n
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: localization #120
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
fba1fc7
feat: localization
AlejandroAkbal 8a74556
chore: Guard console logs with import.meta.client
AlejandroAkbal 9f120ba
chore: update deps
AlejandroAkbal 24e0409
Merge origin/main into i18n
AlejandroAkbal d71c990
feat: Add i18n & locale-aware routing/translation
AlejandroAkbal 2541ae0
Handle Matomo fetch errors in sitemap
AlejandroAkbal 65ba1b7
docs: Add AGENTS.md documentation
AlejandroAkbal 5ffac1c
test: Add SSR canonical URL tests and mocks
AlejandroAkbal d2c8652
chore: Bypass auth in tests; update tests & fetch calls
AlejandroAkbal 32fd88e
test: Append tags to canonical and stabilize posts tests
AlejandroAkbal e81f3d7
feat: Use i18n for UI text; refactor tag/title logic
AlejandroAkbal 9f6e300
Update components/pages/posts/PostsPageFooter.vue
AlejandroAkbal 441ac6c
fix: fixes suggested by coderabbit
AlejandroAkbal 062595d
Merge branch 'i18n' of github.com:Rule-34/App into i18n
AlejandroAkbal bca3438
feat: Internationalize posts, saved-posts and settings
AlejandroAkbal a4b11a8
fix: address CodeRabbit review — localePath guards, Sentry test disab…
AlejandroAkbal 6c02b06
fix: address second CodeRabbit review — mirroredRouteRules, window.op…
AlejandroAkbal 986ab40
fix: third CodeRabbit review — sortLabel translation, hasTags derivat…
AlejandroAkbal 4b9ebc2
fix: fourth CodeRabbit review — filter fallbacks, JSDoc, map collapse…
AlejandroAkbal 1837129
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 172f5e9
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 97dc42a
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] ecc1b79
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 48bbb3c
Preserve canonical ?tags on SSR and CSR
AlejandroAkbal 4abb856
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 256035a
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 9f03318
feat: Move OG/meta to server-side app.vue
AlejandroAkbal 35aa2d3
Merge branch 'i18n' of github.com:Rule-34/App into i18n
AlejandroAkbal 0357cc5
test: Add SEO tests for canonical and og:image
AlejandroAkbal 9e1359a
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] e63eeca
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 637747c
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] 3b8c892
Merge branch 'main' into i18n
AlejandroAkbal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # AGENTS.md | ||
|
|
||
| ## Stack | ||
|
|
||
| - **Nuxt 4** (SSR, Nitro server) with **Vue 3** + TypeScript | ||
| - **TailwindCSS v4** via `@tailwindcss/vite` Vite plugin (NOT PostCSS) | ||
| - **Vitest** + `@nuxt/test-utils` with Playwright browser mode for testing | ||
| - **Prettier** (formatting). ESLint config exists but is not wired to any npm script. | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| cp .example.env .env # then edit .env | ||
| npm install # triggers nuxt prepare via postinstall | ||
| ``` | ||
|
|
||
| - **Node ≥ 24** required (`package.json` engines) | ||
| - **Git submodule** at `assets/lib/rule-34-shared-resources` — clone with `--recursive` | ||
| - **External API**: the app calls a separate API service at `NUXT_PUBLIC_API_URL` (default `http://localhost:8081`). The | ||
| API codebase is at [github.com/Rule-34/API](https://github.com/Rule-34/API). | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | What it does | | ||
| |----------------------|-----------------------------------------------| | ||
| | `npm run dev` | Dev server at `localhost:8080` | | ||
| | `npm run build` | Production build into `.output/` | | ||
| | `npm run generate` | Static generation | | ||
| | `npm test` | `vitest run` | | ||
| | `npm run test:watch` | `vitest watch` | | ||
| | `npm run release` | `standard-version` for versioning + changelog | | ||
|
|
||
| ## Architecture | ||
|
|
||
| Single Nuxt app. Key directories: | ||
|
|
||
| | Dir | Purpose | | ||
| |----------------------|-------------------------------------------------------------------------------------------| | ||
| | `config/` | Centralized project config (`project.ts` for branding/URLs, `i18n.ts` for locales) | | ||
| | `app/` | Nuxt app-level config (router options, SPA loading template) | | ||
| | `composables/` | Shared Vue composables (auto-imported by Nuxt) | | ||
| | `plugins/` | Client plugins loaded in order by numeric prefix (`020.`, `030.`, `035.`, `040.`, `050.`) | | ||
| | `server/api/` | Nitro server API routes | | ||
| | `server/middleware/` | Nitro middleware | | ||
| | `server/plugins/` | Nitro plugins | | ||
| | `assets/js/` | Shared JS utilities, DTOs, custom providers | | ||
| | `assets/lib/` | Git submodule for shared resources | | ||
| | `locales/` | i18n JSON files (en, ru, es, ja) | | ||
| | `components/` | Vue components — **auto-imported flat** (`pathPrefix: false`, no folder prefix) | | ||
| | `test/` | Page tests, server tests, mocks | | ||
|
|
||
| ## Conventions & Gotchas | ||
|
|
||
| ### Component auto-imports | ||
|
|
||
| Components are registered **without path prefix** (`nuxt.config.js` → `components: [{ pathPrefix: false }]`). Import | ||
| them as `<DomainSelector>` not `<Input/DomainSelector>`. | ||
|
|
||
| ### i18n | ||
|
|
||
| - Locales are defined in `config/i18n.ts` (single source of truth). | ||
| - Non-default locales (ru, es, ja) get URL prefixes. Route rules in `nuxt.config` are mirrored via the | ||
| `mirroredRouteRules()` helper so prefixed paths get the same caching/SSR rules. | ||
| - **Known bug**: `canonicalQueries` in the i18n module config is a no-op in v10. A workaround plugin at | ||
| `server/plugins/fix-canonical-queries.ts` patches the canonical `<link>` in SSR output. | ||
|
|
||
| ### Router | ||
|
|
||
| - Custom scroll behavior: skips scroll-to-top when only the `page` query param changes between same-route navigations. | ||
| - Legacy redirect: `server/middleware/redirect-to-posts.get.ts` redirects `/?domain=x&page=…&tags=…` → | ||
| `/posts/x?page=…&tags=…` (301). | ||
|
|
||
| ### Images | ||
|
|
||
| A custom `imgproxy` provider is registered for `<NuxtImg>` (see `nuxt.config.js` → `image.providers`). Images are | ||
| deliberately generated at 1x density only (webp format) to reduce bandwidth. | ||
|
|
||
| ### PWA | ||
|
|
||
| The service worker is intentionally disabled (`selfDestroying: true`). Do not add service worker logic. | ||
|
|
||
| ### TailwindCSS | ||
|
|
||
| Tailwind v4 uses CSS-based config (`assets/css/main.css`), NOT PostCSS. The `tailwind.config.js` remains only for the | ||
| `@headlessui/tailwindcss` plugin. | ||
|
|
||
| ### Sentry | ||
|
|
||
| - Client: configured in `sentry.client.options.ts` (replay, third-party error filter, deny URLs). | ||
| - Server: `sentry.server.config.ts` reads DSN from env vars directly (before Nuxt boots). | ||
| - Source map uploads only happen in production Docker builds (needs `SENTRY_ORG`, `SENTRY_PROJECT`, `SENTRY_AUTH_TOKEN` | ||
| build args). | ||
|
|
||
| ### Testing | ||
|
|
||
| - Tests use `@nuxt/test-utils` with Playwright inside `describe` blocks that call `await setup({ browser: true })`. | ||
| - Server-side API calls are mocked via a test-only Nitro plugin at `test/server-mocks/plugin.ts`, injected through | ||
| `nuxt.config.js` → `$test.nitro.plugins`. | ||
| - In test mode, `$test.runtimeConfig.public.apiUrl` is set to `''` so `$fetch(baseURL: '')` routes to the local Nitro | ||
| test server. | ||
| - Sentry is fully disabled in tests via `$test.sentry.enabled: false` in `nuxt.config.js`. | ||
| - Debug mode: import `debugBrowserOptions` from `test/helper.ts` for headful playback with slowMo. | ||
|
|
||
| ### Docker production build | ||
|
|
||
| - Multi-stage: build stage needs `SENTRY_*` args for source map uploads; production stage copies only `.output/` (no | ||
| `node_modules` needed — Nitro bundles everything). | ||
| - `NITRO_PRESET` build arg selects the deployment target. | ||
|
|
||
| ### Prettier | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| Key settings: 120-char print width, no semicolons, single quotes, trailing commas removed, single attribute per line in | ||
| Vue templates. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.