Closed jonasraoni closed 1 year ago
This is great, @jonasraoni. :+1:
Ah, if needed here there's a better description about the internals: https://github.com/pkp/pkp-lib/pull/7336#issue-1007045487
Added to release notebook and updated dev docs in https://github.com/pkp/pkp-docs/pull/1063. The release notebook links back here for full details. Thanks again, @jonasraoni.
Configuration changes in the config.inc.php
i18n.client_charset
i18n.client_charset
: The setting has been removed, it used to support two options,ISO-8859-1
(LATIN1) andUTF-8
, but we only support UTF-8.general.time_zone
: We're using the time zones available in PHP, therefore the filelib/pkp/registry/timeZones.xml
has been removed, and possible values for this setting must come from the following link https://www.php.net/timezones. Old values from thetimeZones.xml
should still work.Changes in the installation interface
installer.clientCharset
) has been removed, we've been supporting only UTF-8.installer.connectionCharset
) has been removed, we're using only UTF-8.installer.timezoneInstructions
) has been added, to setup the global application time zone.Localization updates
More details about the new localization features can be found in the section Utilities > Translation.
AppLocale::requireComponents(LOCALE_COMPONENT_...)
, the translations for the current locale are preloaded.PKPLocale
andAppLocale
have been deprecated in favour of thePKP\facades\Locale
, only their main methods have been preserved for backwards compatibility purposes. Given the new class is a Laravel's facade, its underlying implementation can be replaced throughPKP\facades\Locale::swap(new CustomLocaleClass())
.Sokil\IsoCodes\IsoCodesFactory
class, which we've been using to retrieve lists of languages, currencies, countries and scripts, has been centralized into the facadePKP\facades\Locale
, respectively by the methodsgetLanguages()
,getLanguages()
,getCurrencies()
,getCountries()
, andgetScripts()
.lib/pkp/registry/locales.xml
has been removed, now the list of locales is built upon the locale folders available for the application (e.g.pkp-lib/locale/
) and the metadata information, such as display name, right-to-left script, etc., is retrieved programatically.AppLocale
methods related to conversions between locale formats (ISO 639-1, ISO 639-2b, ...) have been moved into the classPKP\i18n\LocaleConversion
.AppLocale
methods used to retrieve locale metadata have been moved to the classPKP\i18n\LocaleMetadata
(e.g.getLocaleDirection()
,isLocaleComplete()
).AppLocale::getAllLocales()
has been replaced byPKP\facades\Locale::getLocales()
, but instead of returning the locale display name, it returns aLocaleMetadata
instance, which holds extra information.AppLocale
class:getLocaleStyleSheet()
,getLocalePrecedence()
,getLocaleFiles()
,loadLocaleList()
,addOctothorpes()
,initialize()
,makeComponentMap()
,getFilenameComponentMap()
,registerLocaleFile()
,getLocaleStyleSheet()
,isLocaleWithFamilyFirst()
,reloadLocale()
,getParameterNames()
, andgetTimeZone()
.PKPLocale::translate
toLocale::translate
, and its arguments have been modified as well.General updates
__p(string $key, int $number, array $replace = [], ?string $locale = null)
has been introduced to translate pluralized locale keys.APP\core\Application::isUpgrading()
to replace the constantRUNNING_UPGRADE
.APP\core\Application::isInstalled()
as a shortcut toConfig::getVar('general', 'installed')
.APP\core\Application::isUnderMaintenance()
to check if the application is installed and not being upgraded.PKP\session\SessionManager::isDisabled()
to replace the constantSESSION_DISABLE_INIT
.Smarty templates
translate
tag has been extended to support pluralized locale keys, the new syntax is as follows:{translate key="localization.key.name" count="10" paramName="paramValue"}
, it's also possible to feed alocale
param.translate
modifier has also been extended to support pluralized locale keys, this is the new syntax:{$foo|translate:count:123:locale:pt_BR:paramName:paramValue}
.