-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor localization for not changing UF locale for each string #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I can't help with the review, but I have carried out a test with the an environmental registration form and can confirm that the form now loads much faster.
Exactly what we needed, thanks for that! Let's wait for a code review though, as this copies some code from Core's |
b26e85d
to
f57a2ee
Compare
Noting that this approach might cause side effects when using native GetText, as in this case instantiating a new // CRM-11833 Avoid LC_ALL because of LC_NUMERIC and potential DB error.
setlocale(LC_TIME, $locale);
setlocale(LC_MESSAGES, $locale);
setlocale(LC_CTYPE, $locale); and does not reset afterwards, so within the same request the latest processed locale gets stuck for concurrent translations. With the PhpGetText this is capsuled in the |
Also, when using a |
Actually, calling |
This should drastically improve performance for localized remote event forms with many fields/many field options.
Testing should involve a requested locale different from the current default locale (i.e. CiviCRM running in English, requested locale being another language).
This makes use of some code copied from Core's
ts()
function to make it work with locales other than the current default one.Since localization might get very slow, this should be cherry-picked for the
1.2.x
branch as well.systopia-reference: 25219