fix(transloco): accept a scope in selectTranslateObject lang argument - #1001
fix(transloco): accept a scope in selectTranslateObject lang argument#1001arturovt wants to merge 1 commit into
Conversation
At runtime selectTranslateObject already loads an unloaded scope file
when you pass the scope as the third argument, but the type only allowed
a plain string. That made the documented "loads the file if not loaded"
behaviour unreachable without a cast when passing a { scope, loader }
object.
Widen the string / string[] key overloads to accept
string | TranslocoScope | TranslocoScope[], matching selectTranslate.
The key-map overload is left as a plain string since that path does not
support a scope.
Closes jsverse#529
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthrough
ChangesScoped translation object selection
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change makes already-supported scoped translation loading type-safe without changing the runtime loading mechanism. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description explains the current type limitation, the new overload behavior, the key-map exception, and the linked issue. It omits the repository checklist and explicit PR type and breaking-change selections, but the main technical information is complete. Full details: Linked Issues checkExplanation The changes address issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@jsverse/transloco
@jsverse/transloco-keys-manager
@jsverse/transloco-locale
@jsverse/transloco-messageformat
@jsverse/transloco-optimize
@jsverse/transloco-persist-lang
@jsverse/transloco-persist-translations
@jsverse/transloco-preload-langs
@jsverse/transloco-schematics
@jsverse/transloco-scoped-libs
@jsverse/transloco-utils
@jsverse/transloco-validator
commit: |
At runtime selectTranslateObject already loads an unloaded scope file when you pass the scope as the third argument, but the type only allowed a plain string. That made the documented "loads the file if not loaded" behaviour unreachable without a cast when passing a { scope, loader } object.
Widen the string / string[] key overloads to accept string | TranslocoScope | TranslocoScope[], matching selectTranslate. The key-map overload is left as a plain string since that path does not support a scope.
Closes #529
Summary by CodeRabbit
Enhancements
selectTranslateObjectto support scoped translations, including loading translations from unloaded scopes.Tests