-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Standalone - check logged in User's locale in multilingual mode #32444
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
FYI @seamuslee001 this seems to work from local testing but could definitely do with some more interrogation |
@seamuslee001 this patch is smaller. Does yours cover anything extra though that this one misses? |
@colemanw @ufundo I haven't looked at what standalone does off the back of the Config::singleton() call. I would note that for both WordPress and Drupal8 They set the TimeZone well after everything in CRM_Core_Config is done. In my other PR I did it that way as I figured that the order or the steps here was important for Standalone as I thought that was what you were saying on Thursday/Friday @ufundo in the meeting. |
That was my memory @seamuslee001 .. but looking at it again I couldn't see the dependency. I think maybe there was some other issue with |
From testing on the demo site, I've been able to:
I tried setting my user language preference to German, and that doesn't seem to work yet. |
@ufundo i think the language preference on the civicrm_contact record might only be used for things like schedule reminders. Maybe we need to have a locale field or something on the uf_match (user) table to say this logged in user should be in locale y or something? I also feel like needing to use the lcMessages url param feels not brilliant but do accept at the moment it is the way to switch locales @mlutfy do you have any thoughts on locale handling in standalone? I |
@seamuslee001 there is already a language option on the Standaloneusers user record. I'm looking at bit more now and there are a few hurdles:
On the basis of 3, I'm not sure if this fix is right. |
I don't have much to add here, but just wanted to double-check:
I guess one annoying thing is that a user will have a default language preference (on their user record), and may also want to temporarily change their UI preference (using a language switcher, and therefore the For example, some features in CiviCRM depend on the language of the UI (PDF Letters / Send Mail, with tokens, for example, and most likely receipts). There are also some fields/settings in multi-lingual that are only translatable if you change the entire UI. |
97c520b
to
5f40c51
Compare
settings/Localization.setting.php
Outdated
@@ -218,11 +218,11 @@ | |||
'quick_form_type' => 'YesNo', | |||
'default' => '0', | |||
'add' => '4.3', | |||
'title' => ts('Inherit CMS Language'), | |||
'title' => ts('Inherit User Language'), |
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.
@ufundo I don't like changing this because for WP/Joomla/BackDrop/Drupal8 we are inheriting from the CMS not the user setting (User setting may affect what the CMS sets)
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.
@mlutfy what do you think about the language changes here?
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.
Ah. I was thinking it was the User either way (Standalone user or CMS user)... hadn't thought the CMS could decide on language another way.
"Inherit CMS/User Language"?
I think there's a few places like this where the ideal would be to override the wording on Standalone - I think that should be possible using a hook on settings meta, but I haven't quite pinned it down.
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.
In WordPress / Drupal the default method CMS sets the locale especially for anonymous users is via the url path e.g /en/ or /fr/ etc.
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.
Have updated to use alterSettingsMetaData
hook in standaloneusers, so the wording is only changed on Standalone 👍
5f40c51
to
3428ad9
Compare
Language setting from the user is happening the same way it does on the CMSes. The
One thing I was wondering is why we have a language option on the User record, given there is also a preferred language on the Contact record for that user. I used the value from the User record because it is there. But maybe we could get rid of that and just use the Contact value? (I don't know if there are times you might when either Someone might want a different value on their Contact / User records; or if as a site-builder you might want different options available on Contact record vs User record?) |
Update: it looks like language is on UFMatch and so isn't introduced by Standalone. In which case removing it is harder. So prob I'd guess we leave it. Maybe At any rate, I don't think it would be |
3428ad9
to
6a6a381
Compare
Update
Following #32525 this now just contains the implementation of
getUFLocale
for Standalone to read the logged in User's locale setting as part of theapplyLocale
cascade.This behaviour is controlled by the
inheritLocale
setting.Overview
Attempt to unbreak multilingual on Standalone.
Before
postContainerBoot
is the first thing that runs after the container has bootedpostContainerBoot
hookAfter
movepostContainerBoot
two steps later: afterSettings
is fully booted (can load db values) and afterapplyLocale
is calledhook_civicrm_config
shouldn't expect timezone as it stands)postContainerBoot
should come beforeapplyLocale
. There's also a note about temporarily setting dbLocale before checkinggetUFLocale
, which sounds like related issue to the initial crashComments
Is there any reason
postContainerBoot
is exactly where it is? I remember in the work to get Standalone stable there used to be a crash inapplyLocale
, though I can't remember exact details, or if it had any interaction withpostContainerBoot
, and so that was an important constraint. But looking at the commit history, I suspect it's just "where it always was".~~It would be good to retest the various bugs we found in Standalone timezone handling (PHP + MySQL) for any regressions on that front.
And see what Jenkins says.