Skip to content
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

Upgrade paraglide for nested translation fields, continue adding translations #2258

Merged
merged 4 commits into from
Mar 11, 2025

Conversation

spwoodcock
Copy link
Member

@spwoodcock spwoodcock commented Mar 7, 2025

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Fixes #2257
Towards #2249

Describe this PR

  • Paraglide had a major upgrade in the past week - v2 with lots of nice features.

  • One of many is nested translation fields, making management easier:

        "task_states": {
    	    "UNLOCKED_TO_MAP": "Ready",
    	    "LOCKED_FOR_MAPPING": "Locked For Mapping",
    	    "UNLOCKED_TO_VALIDATE": "Ready For Validation",
    	    "LOCKED_FOR_VALIDATION": "Locked For Validation",
    	    "UNLOCKED_DONE": "Validated"
        },
  • For the example above we can use in code like: m[''task_states.UNLOCKED_TO_MAP]()

  • One major change: updating locale now causes a full page reload:

    • This isn't actually that bad - it's rare people change language much.
    • Language is identified from (1) localStorage (2) navigator.locale (3) paraglide (in this priority order).
    • The advantage is that code splitting can take place for the required translations by the bundler - we get full tree shaking of unused translations!
  • I also continued to add translation fields to the mapper frontend - work in progress!

  • The actual translation to pt-BR for MdP can be done on inlang Fink by external contributors (non-devs).

  • Also, I recommend the Sherlock VSCode extension that analyses each file for translation fields,

Screenshots

image

Translation fields to be filled:

image

Alternative Approaches Considered

Did you attempt any other approaches that are not documented in code?

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@spwoodcock spwoodcock requested a review from DanielJDufour March 7, 2025 00:08
@spwoodcock spwoodcock self-assigned this Mar 7, 2025
@github-actions github-actions bot added enhancement New feature or request frontend Related to frontend code labels Mar 7, 2025
@spwoodcock spwoodcock force-pushed the feat/pt-br-translations branch from db940ce to 30a1895 Compare March 11, 2025 06:47
@spwoodcock spwoodcock merged commit eb8d5e5 into development Mar 11, 2025
6 checks passed
@spwoodcock spwoodcock deleted the feat/pt-br-translations branch March 11, 2025 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend Related to frontend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Small bug with locale switcher not updating
1 participant