Skip to content

refactor(i18n): dynamic locale routing with [lang] pages#8

Open
ramistodev wants to merge 1 commit intomidudev:mainfrom
ramistodev:refactor/local-routing
Open

refactor(i18n): dynamic locale routing with [lang] pages#8
ramistodev wants to merge 1 commit intomidudev:mainfrom
ramistodev:refactor/local-routing

Conversation

@ramistodev
Copy link
Copy Markdown

This pull request improves internationalization (i18n) and accessibility across the application, especially for mobile and ARIA labels. It also generalizes locale handling for URLs and algorithm selection, and cleans up translation keys for consistency. The most important changes are grouped below:

Internationalization and Accessibility Improvements:

  • Replaces hardcoded English/Spanish ARIA labels and mobile UI strings in AlgoViz.tsx and Header.tsx with values from the Translations object, ensuring all labels and mobile titles are properly localized and accessible. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Adds new translation keys for ARIA labels and mobile UI elements (e.g., sidebarAriaLabel, codePanelAriaLabel, openMenu, closeMenu, viewCode, languageLabel) to the Translations interface and provides translations for both English and Spanish. [1] [2] [3]

Generalization of Locale Handling:

  • Updates URL and algorithm ID parsing logic in AlgoViz.tsx to support any locale, not just English/Spanish, by using the locales and defaultLocale arrays from the translations module. This makes the app more scalable for future languages. [1] [2]

  • Updates [algorithm].astro page to use defaultLocale for all locale-dependent logic, making the page generation and metadata consistent with the new i18n approach. (src/pages/[algorithm].astroL5-R5, src/pages/[algorithm].astroL17-R22)

Translation Key Consistency:

  • Cleans up translation files by changing object keys from quoted strings to unquoted property names (e.g., 'recursion'recursion), improving consistency and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Minor Code Style Improvements:

  • Formats some JSX elements for readability and consistency, such as multiline attributes and SVG formatting in Header.tsx. [1] [2] [3]

Function Signature Cleanup:

  • Cleans up the signature of getAlgorithmMetaTitle in translations.ts for improved readability.

These changes together make the app more robust for internationalization, improve accessibility, and lay the groundwork for adding more locales in the future.- Replace hardcoded pages/es/ with dynamic pages/[lang]/

  • getStaticPaths now uses locales/defaultLocale from translations.ts
  • Remove hardcoded 'es' strings from AlgoViz.tsx and Header.tsx
  • Add missing translation keys (openMenu, closeMenu, sidebarAriaLabel, etc.)

- Replace hardcoded pages/es/ with dynamic pages/[lang]/
- getStaticPaths now uses locales/defaultLocale from translations.ts
- Remove hardcoded 'es' strings from AlgoViz.tsx and Header.tsx
- Add missing translation keys (openMenu, closeMenu, sidebarAriaLabel, etc.)
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

@ramistodev is attempting to deploy a commit to the midudev pro Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant