Fix getFixedT function always returning values in current language #1916
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.
I was running into an issue where
getFixedT
always returned values in the current language not the requested language. I found this issue - #1184 about it. The fix for it was merged in and released and seemed to work. However a bit later the fix got reverted as people did not expect all locales to be loaded by the library. See the following issue - #1267.This PR proposes a potential new argument to the
serverSideTranslations
function (could also be a config override field really). This argument can be used to provide extra locales to load for the specific page and allows one to opt into loading more or all locales. As a resultgetFixedT
will then work for the locales that are loaded for the page.Checklist
npm run test