Skip to content

Conversation

@yashhhguptaaa
Copy link

@yashhhguptaaa yashhhguptaaa commented Jan 4, 2026

  • Add language detection (browser + localStorage)
  • Add setLang function for runtime language switching
  • Extract 1527 translatable strings to en.json
  • Implement loader with English fallback for missing translations
  • Add /locales alias in Vite config for clean imports

Closes #519


Summary by cubic

Add a shared i18n framework with browser/localStorage language detection, runtime language switching, and English fallback. Wired both apps to lazy-load locale files via a Vite /locales alias. Closes #519.

  • New Features

    • New i18n provider with SUPPORTED_LANGUAGES (en, fr), DEFAULT_LANG, and detectLanguage() (localStorage → browser → default).
    • Runtime switching via setLang; useTranslate now returns { lang, setLang, __ }.
    • Loader merges selected language over English for safe fallback.
    • Extracted ~1.5k strings to packages/i18n/locales/en.json.
    • Barrel export at @probo/i18n; both apps now use it and a dynamic loader (import.meta.glob).
    • Added /locales alias in Vite for clean JSON imports.
  • Migration

    • Add new locales at packages/i18n/locales/.json (keys match en.json); missing keys fall back to English.
    • Remove hardcoded lang prop; call useTranslate().setLang('en' | 'fr') to switch at runtime.
    • Ensure app builds include the /locales alias (already added here).

Written for commit 6af3f3c. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/i18n/locales/en.json">

<violation number="1" location="packages/i18n/locales/en.json:98">
P3: Typo: space before question mark. English typography does not use a space before punctuation marks. This appears to be a copy-paste from French text or a typo.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"Anguilla": "Anguilla",
"Antarctica": "Antarctica",
"Antigua and Barbuda": "Antigua and Barbuda",
"Are you sure ?": "Are you sure ?",
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 4, 2026

Choose a reason for hiding this comment

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

P3: Typo: space before question mark. English typography does not use a space before punctuation marks. This appears to be a copy-paste from French text or a typo.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/i18n/locales/en.json, line 98:

<comment>Typo: space before question mark. English typography does not use a space before punctuation marks. This appears to be a copy-paste from French text or a typo.</comment>

<file context>
@@ -0,0 +1,1529 @@
+  &quot;Anguilla&quot;: &quot;Anguilla&quot;,
+  &quot;Antarctica&quot;: &quot;Antarctica&quot;,
+  &quot;Antigua and Barbuda&quot;: &quot;Antigua and Barbuda&quot;,
+  &quot;Are you sure ?&quot;: &quot;Are you sure ?&quot;,
+  &quot;Are you sure you want to delete the NDA file?&quot;: &quot;Are you sure you want to delete the NDA file?&quot;,
+  &quot;Are you sure you want to delete the invitation for %s?&quot;: &quot;Are you sure you want to delete the invitation for %s?&quot;,
</file context>
Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

@cubic-dev-ai

This is fine and expected. The string is only being used as the country name.

- Add language detection (browser + localStorage)
- Add setLang function for runtime language switching
- Extract 1527 translatable strings to en.json
- Implement loader with English fallback for missing translations
- Add /locales alias in Vite config for clean imports

Closes getprobo#519

Signed-off-by: Yash Gupta <[email protected]>
@yashhhguptaaa
Copy link
Author

@SachaProbo @gearnode, please take a look at this PR at your convenience.

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.

Internationalization (i18n) / Multi-language Support

1 participant