Problem/Motivation
EntityTypeBundleInfo returns wrong language version when called before language negotiation is finished.
Turns out it still has a static cache property (not aware of cache contexts like language or cache tag invalidation).
Steps to reproduce
After quire some debugging it boils down to this minimal test-code:
- Set current interface language to en
- Call EntityTypeBundleInfo::getAllBundleInfo
- Set current interface language to de
- Call EntityTypeBundleInfo::getAllBundleInfo
- Expected: Get de translation.
- Actual: Get en translation.
This happened on my installation in this scenario:
- Have an entity (commerce_store) with some paragraph fields
- `drush cr`
- Create (not edit) commerce store (in my case in group context)
- Expected: See Paragraph button "[DE bundle label] hinzufügen"
- Actual: See Paragraph button "[EN bundle label] hinzufügen"
- FTR: Also, clicking that paragraph button adds a *different* paragraph (that with the last button) to the form. (Which looks like a separate form builder bug.)
Proposed resolution
Replace static cache with memory cache backend (like everywhere else).
Remaining tasks
- Code, review, commit.
User interface changes
None.
API changes
None.
Data model changes
None.