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
Methods
No description
The ID of the extension whose language pack registered this locale.
Details
at
line 39
__construct( Translator $translator, string|null $cacheDir = null, SettingsRepositoryInterface|null $settings = null)
at
line 72
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. In debug mode the catalogue cache checks the resources as well (see {\Flarum\Locale\CatalogueCache}).
at
line 80
protected string
revisionStamp()
at
line 85
string
getLocale()
at
line 90
void
setLocale(string $locale)
at
line 95
void
addLocale(string $locale, string $name)
at
line 100
array
getLocales()
at
line 105
bool
hasLocale(string $locale)
at
line 110
void
setLanguagePackId(string $locale, string $extensionId)
at
line 118
string|null
getLanguagePackId(string|null $locale)
The ID of the extension whose language pack registered this locale.