dev/civicrm-setup#1 CRM_Core_I18n - Don't require immediate bootstrap #11682
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
For civicrm/civicrm-setup#1, the general goal is to allow installing the
database schema without needing to run
GenCode
.The current draft is crashing because the SQL does translation using
ts()
.But if you try to use
ts()
in a pre-boot environment, it will attempt toboot automatically so that it can read
$config->customTranslateFunction
.This is a chicken-egg situation. We haven't yet reached the phase where the
installer can boot up Civi... because we don't have the SQL... but the SQL
can't be generated (translated) because Civi hasn't been booted.
The aim of this patch is to loosen the coupling between
ts()
and
CRM_Core_Config
so thatts()
can be used on its own.Before
ts()
callsCRM_Core_Config::singleton()
to probe forcustomTranslateFunction
.static
variable to avoid extra lookups.After
1..n
invocations (pre-boot),ts()
callsgetBootService()
to see if we're ready. On the first successful result, it callsCRM_Core_Config::singleton()
to probe forcustomTranslateFunction
.static
variable to avoid extra lookups.Comments
For
r-run
testing, I've done a few things:en_US
tofr_FR
and observe UI displays the new language.en_US
andfr_FR
) and enable CMS-language inheritance. In Drupal, setup user preferences. Observe that the active language in Civi tracks the user preference.bin/setup.sh -g
. Spot-checksql/civicrm_data.fr_FR.mysql
to ensure that it contains translated strings.civicrm.settings.php
, create a functionswedishchef($string)
. Go to "Administer => Localization => Language" and useswedishchef
as the translation function. Observe that translations use this.(Note: UI elements in the dashboard are cached and require an explicit refresh to reflect changes in the language settings. The nav-menu gets translated most of the time, but it never seems to use custom-translation-function. However, that's not a new regression -- the same problem occurs without this patch.)