-
Notifications
You must be signed in to change notification settings - Fork 2
Locale
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Models\Locale is the ActiveRecord model for locales (language + country), translation files, and app default locale behavior.
getDefault(): ?Locale-
getByRepresentation(string $representation): ?Locale(e.g.en-GB) getDefaultByLanguage(string $languageCode): ?Locale
getRepresentation(string $separator = '-'): stringisDefault(): boolisOfficialLanguage(): boolisDefaultCountry(): bool
getFilePath(string $module): stringreadTranslation(?Module $module): arraywriteTranslation(array $strings, ?Module $module): boolisFileWritable(string $moduleName): bool
$locale = \Pair\Models\Locale::getByRepresentation('en-GB');
$code = $locale?->getRepresentation();Read common translations:
$strings = $locale->readTranslation(null);Write module translations:
$locale->writeTranslation([
'WELCOME' => 'Welcome',
'SAVE' => 'Save'
], $module);See also: Translator, User, Configuration-file.