Skip to content

Add English/Vietnamese i18n and shared navigation - #136

Open
lcaohoanq wants to merge 2 commits into
Tanq16:mainfrom
lcaohoanq:main
Open

lcaohoanq wants to merge 2 commits into
Tanq16:mainfrom
lcaohoanq:main

Conversation

@lcaohoanq

Copy link
Copy Markdown

Summary

  • Extract shared nav into nav.js and wire it on dashboard, table, and settings pages
  • Add lightweight DIY i18n (i18n.js) with English + Vietnamese dictionaries and a Settings language picker (localStorage, like theme)
  • Localize date formatting via getDateLocale() while leaving existing currency (including VND) behavior unchanged

Test plan

  • Run locally or via Docker and open http://localhost:8080
  • Settings → Language → Tiếng Việt; confirm labels update on Settings and after reload on Dashboard/Table
  • Confirm nav active state is correct on /, /table, and /settings
  • Confirm month/date formatting uses Vietnamese locale when vi is selected
  • Confirm VND currency formatting still works
  • Confirm theme and language persist independently in localStorage

Adding another language

Add another locale the same way as vi — three small places in i18n.js plus the Settings select.

1. Allow the code in I18N_SUPPORTED

const I18N_SUPPORTED = ['en', 'vi', 'de'];

2. Add a dictionary under translations

Use the same keys as en (copy en, translate values).

3. Map the date locale in getDateLocale()

function getDateLocale() {
    const map = { en: 'en-US', vi: 'vi-VN', de: 'de-DE' };
    return map[getLanguage()] || 'en-US';
}

4. Add an option in Settings (settings.html)

<option value="de" data-i18n="settings.langDe">Deutsch</option>

Also add settings.langDe to every language dict (including en / vi).


That’s it — t(), applyI18n(), nav, and localStorage already work for any code in I18N_SUPPORTED. Keep key parity with en so nothing falls back to raw keys.

Summary by CodeRabbit

  • New Features
    • Added English and Vietnamese language support across the dashboard, transactions, and settings pages.
    • Added a language selector with saved preferences and localized dates, labels, buttons, forms, messages, and navigation.
    • Added shared navigation with active-page highlighting.
    • Expanded recurring transaction settings with occurrence limits and report-gain options.
  • Bug Fixes
    • Date formatting now follows the selected language and locale.

lcaohoanq and others added 2 commits July 26, 2026 22:24
Extract duplicated nav into a shared module and add a lightweight locale layer with a Settings language picker so the UI can switch between en and vi without a framework rewrite.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add English/Vietnamese i18n and shared navigation
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