-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/main/i6328 improved localization #7336
Feature/main/i6328 improved localization #7336
Conversation
@jonasraoni, there are lots of useful clean-ups here, but it's impossible to review the code thoroughly when they're mixed together; could you separate them into individual commits? For example,
|
One more request: could you document the changes that developers using older versions of OJS will need to know in adapting their code to this? It'll give me something to think about while reviewing, plus @NateWr can collect this for his release notebook. See #6091 (comment) for an example. |
Ok! I think I'll create new issues for these extra modifications. |
5edc1ee
to
5fd4a99
Compare
86194ef
to
4148b82
Compare
4148b82
to
f39c880
Compare
f39c880
to
ab2c3b2
Compare
2673893
to
df02b8b
Compare
fa20575
to
90f3703
Compare
- The Laravel container is always initialized - Removed the need of loading specific components by loading all registered locale files - Integrated with the Laravel translation system and removed workaround patch - Added a Laravel Facade to access the Locale where DI isn't available - Simplified the time zone handling (the list is now loaded from PHP) - Enabled the Laravel caching system and added a OpCache driver (cached *objects* must implement the __set_state)
…/install status
…ster) and cached the result to reduce disk usage
…ended the current translate tag and modifier
…sion when doing small checks
- Update code to replace the locales.xml (added detection of text direction + completeness calculation + integrated ISO Alpha 2/3) - Implemented an "IsoCodes" translation driver to replace the default driver, the GettextExtensionDriver doesn't work very well and the SymfonyTranslationDriver has a memory/performance issue.
…ds compatibility with external plugins
…rnal plugins (PHP 8 emits fatal error when accessing missing constants)
90f3703
to
f80c4ad
Compare
Description
plugin/locale/en/common.po
), the code is now expecting a folder (e.g.plugin/locale
), which should follow a single rule: its direct sub-folders should refer to locale names (e.g../en_US
,./pt_BR
, etc.).LocaleBundle
(a merged collection with all the translation files found for the given locale), if not found, it will build one.LocaleBundle
LocaleBundle
is requested, theLocale
class will pass through the registered folders (it's also possible to register a callback/dynamic file loader), access the sub-folder related to the requested locale (e.g../en_US
), and retrieve the available.po
files recursively. These files will be sent to the newly createdLocaleBundle
.Translation
LocaleBundle
will attempt to find the translations (merged .po files) in the disk/cache. The cache key is built using the path + modified date of its locale files + expiration interval. This way, any modification in the expiration, order of files, paths or modification dates will invalidate the cache.en_US
bundle, each one with around ~450KB).Merging physically the locale files into a single one would also give a little performance bump.