Add Language detection and additional language support#254
Open
camrun91 wants to merge 3 commits into
Open
Conversation
|
cameronapak
previously approved these changes
Jun 5, 2026
Collaborator
cameronapak
left a comment
There was a problem hiding this comment.
I like this PR. Good work. I am waiting on one response from Greptile
Collaborator
Author
|
@cameronapak I got the greptile things addressed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This puts into place the initial localized strings.
Greptile Summary
This PR introduces browser language detection and adds French and Spanish locale bundles to the YouVersion platform SDK, wiring up i18next to auto-select a locale on mount via
syncBrowserLanguageFromNavigator.detectLanguage.ts) readsnavigator.languages/navigator.language, resolves to a supported locale via exact-then-base BCP 47 matching, and is fully SSR-guarded.index.ts) addsfrandesresource bundles, callsgetInitialLanguage()at module load for CSR paths, and exportssyncBrowserLanguageFromNavigatoras the runtime correction hook.YouVersionProvidercallssyncBrowserLanguageFromNavigatorin auseEffect([])on mount (already updated from a previous review to avoid the SSRuseLayoutEffectwarning).Confidence Score: 5/5
The change is safe to merge — detection logic is SSR-guarded, locale bundles are complete, and the two-phase init + effect approach is correct.
The detection and resolution logic is well-structured with proper SSR guards and fallback handling. Bundled resources mean init completes before the effect fires, and the idempotent check in syncBrowserLanguageFromNavigator prevents unnecessary language changes.
No files require special attention.
Important Files Changed
void.Sequence Diagram
sequenceDiagram participant Browser participant Module as i18n/index.ts (module load) participant Detect as detectLanguage.ts participant i18next participant Provider as YouVersionProvider participant Effect as useEffect([]) Browser->>Module: "import @/i18n" Module->>Detect: "getInitialLanguage() -> getBrowserLanguages()" Detect-->>Module: navigator.languages (or undefined in SSR) Module->>Detect: resolveBrowserLanguage(langs, supportedLngs, 'en') Detect-->>Module: resolved locale (e.g. 'fr') Module->>i18next: ".init({ lng: 'fr', resources, supportedLngs, fallbackLng })" i18next-->>Module: initialized (async, resources are inline) Browser->>Provider: mount YouVersionProvider Provider->>Effect: schedule useEffect Effect->>Detect: "syncBrowserLanguageFromNavigator() -> getBrowserLanguages()" Detect-->>Effect: navigator.languages Effect->>Detect: resolveBrowserLanguage(...) Detect-->>Effect: resolved locale Effect->>i18next: "changeLanguage(locale) if i18n.language != locale"Prompt To Fix All With AI
Reviews (3): Last reviewed commit: "Merge branch 'main' into localization" | Re-trigger Greptile