Skip to content

fix: use translation instead of hardcoded loading string#1683

Merged
secondl1ght merged 3 commits intodevfrom
fix/translation
Apr 10, 2026
Merged

fix: use translation instead of hardcoded loading string#1683
secondl1ght merged 3 commits intodevfrom
fix/translation

Conversation

@secondl1ght
Copy link
Copy Markdown
Member

🌐 Replace hardcoded loading text with i18n translation in InputField

Summary

Replaced the hardcoded 'Loading...' default value for the loadingText prop in the InputField molecule with a proper next-intl translation using the existing common.loading key from en.json.

Changes

  • src/components/molecules/InputField/InputField.tsx
    • Added 'use client' directive (required for the useTranslations hook, consistent with other molecules)
    • Imported useTranslations from next-intl
    • Removed hardcoded 'Loading...' default from the loadingText prop
    • Added useTranslations('common') hook and resolved loading text via loadingText ?? t('loading')
    • Callers can still override loadingText explicitly if needed

No Test Changes Required ✅

The global next-intl mock in src/config/test.ts already uses the actual en.json messages, so all 12 existing tests pass without modification. Snapshots updated cleanly since the translated value matches the previous hardcoded string.


Related

Screenshots

  • N/A — no visual changes

Notes

  • Add any additional notes here

This pull request summary was generated, for full implementation details please reference the file changes.

@secondl1ght secondl1ght added this to the Prague - 2026 milestone Apr 10, 2026
@secondl1ght secondl1ght requested a review from Orlandohub April 10, 2026 02:30
@secondl1ght secondl1ght self-assigned this Apr 10, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR replaces a hardcoded 'Loading...' default with a next-intl translation lookup (common.loading) in InputField, and adds the required 'use client' directive so useTranslations can be used. The change is minimal, consistent with how other molecules handle translations, and all existing tests continue to pass.

Confidence Score: 5/5

Safe to merge — the change is a minimal, correct i18n substitution with no behavioral or structural risks.

No P0 or P1 findings. The 'use client' directive is necessary and correct for useTranslations, consistent with other molecules. The fallback logic using ?? is correct. All existing tests pass. No custom rules are violated.

No files require special attention.

Important Files Changed

Filename Overview
src/components/molecules/InputField/InputField.tsx Added 'use client' directive and useTranslations('common') hook to resolve loadingText via translation fallback; no logic changes beyond the hardcoded string removal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[InputField render] --> B{loadingText prop provided?}
    B -- Yes --> C[Use provided loadingText]
    B -- No --> D[Lookup common.loading via t]
    C --> E[resolvedLoadingText]
    D --> E
    E --> F{loading === true?}
    F -- Yes --> G[Display resolvedLoadingText in input]
    F -- No --> H[Display value prop in input]
Loading

Reviews (1): Last reviewed commit: "fix: use translation instead of hardcode..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

🚀 Preview Deployment

URL: https://franky-preview-pr-1683-fzxmjul7ya-oa.a.run.app

franky-preview-pr-1683980442d

Copy link
Copy Markdown
Contributor

@Orlandohub Orlandohub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@secondl1ght secondl1ght enabled auto-merge April 10, 2026 18:52
@secondl1ght secondl1ght added this pull request to the merge queue Apr 10, 2026
Merged via the queue into dev with commit 8734eae Apr 10, 2026
14 checks passed
@secondl1ght secondl1ght deleted the fix/translation branch April 10, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants