class LocaleManager
Constants
| REVISION_STAMP_KEY |
A setting any extension can bump to declare that translations have changed somewhere the registered files cannot show — the database, most obviously. Its value is opaque: only whether it differs matters. |
Properties
| protected array | $locales |
|
||
| protected array | $js |
|
||
| protected array | $css |
|
||
| protected list<string> | $registered | Every translation file registered on this instance, as `<locale>|<prefix>|<file>`. |
|
Methods
No description
Details
at
line 37
__construct(Translator $translator, string|null $cacheDir = null, SettingsRepositoryInterface|null $settings = null)
at
line 69
string
revision()
Identifies the translations this instance has been given.
A compiled catalogue's filename covers only the fallback locales, and in production `ConfigCache::isFresh()` answers `is_file()` — so once a catalogue exists nothing detects that the translations behind it have changed. Enabling an extension on one instance therefore leaves every other instance serving a catalogue that predates it, indefinitely: no mtime, no TTL and no revision would ever say otherwise, and only deleting the file forces a rebuild. This is derived from what an instance can see for itself — the files it was given, plus a stamp for translations that live elsewhere — so an instance that has been told nothing still works out that its catalogue is stale. Two instances given the same translations arrive at the same value, which is what keeps them from rebuilding in turn forever. Deliberately not derived from the contents or timestamps of those files: that would mean asking each registered resource whether it is fresh, which runs third-party code that has never executed in production — some of it resolving services and querying the database on every request. A file edited in place, with nothing added or removed and no stamp bumped, is the one change this does not see; clearing the cache covers it, which a deployment does anyway.