Potx has added support for extracting translatables from Drupal 8 shipped config. But l10n_server needs to override some of its behaviour, before it can use it.
Specifically, when scanning a module, potx needs to find its dependencies (including core) in the local filesystem. L10n_server should try to use a database instead, so that there is no need to extract all its dependencies into the local filesystem.
There was an original implementation using database in potx, which is available at https://www.drupal.org/node/1933988#comment-10352733 . I'll try to make an initial patch here, based on that code, soon.
Comments
Comment #2
gábor hojtsyMarking critical and parenting to #2559711: [meta] Drupal.org (websites/infra) blockers to Drupal 8.0.0, 8.1.0, etc. now.
Comment #3
gábor hojtsyComment #4
gábor hojtsySo I rolled out potx updates to l.d.o due to other fixes and without this integration code, it fatals out and does not work at all. :/ I *think* we need this minimal code to make them work together for now.
Comment #6
gábor hojtsyRolled this out for now. That seems to work for now as a hotfix.
Comment #7
herom commentedI've ported the code from https://www.drupal.org/node/1933988#comment-10352733 .
Unfortunately, I don't have a l10n_server installation to actually test this out (although I do expect it to work).
I don't know what the next step should be here. Maybe someone could try to test this out, until I get the chance to set up a l10n_server install.
Comment #8
gábor hojtsyComment #9
drummI tested this by building out shipped-localize.dev.devdrupal.org, clicking 'Start over' for the latest release at https://shipped-localize.dev.devdrupal.org/admin/l10n_server/projects/re..., and running cron.
The attached patch changes:
l10n_drupal_update_7100(). Update functions should have a snapshot of the schema at that point in time, andl10n_drupal_schema()will change in the future.l10n_drupal_parsed_module_data'spidcolumn wasn't actually used. I removed it and made the primary keymodule_name.db_merge()needs values to be serialized before they go in.To do:
l10n_drupal_parsed_module_data'smodule_versioncolumn exists, but is not used. If it should be used, I expect it will go in the table's primary key. Otherwise, remove it.parsed_schemaget populated at all._l10n_drupal_schema_load()should fall back to the potx default if it doesn't have the processed schema in the DB. We won't be parsing the D8 projects in any particular order, so there will be plenty of things parsed before their dependencies. This manifests as:Comment #10
herom commentedThanks for the testing and fixes.
Some fixes were required in potx. You can follow them here: #2615930: Fix integration issues with l10n_server. They are already committed, so you can get the latest dev version, and try again.
module_versionisn't used here, so I removed it. But it will be needed later in dependency resolution, so if a module's dependency isfoobar (=8.x-1.2), we should load exactly that version's config schema. I can bring them back, if you want.parsed_schemawasn't being populated, it's fixed in the potx issue above.Also made 2 fixes in the patch here. Interdiff attached.
Comment #11
drummLooks good. I still don't have anything stored in
parsed_schema, but maybe I haven't parsed an interesting module yet. I do see the fixes should improve it.I recommend also removing
l10n_drupal_schema_reverse_lookup's unusedlidcolumn. The primary key can be eitherarray('schema_key')orarray('schema_key', 'module_name'), depending on whetherschema_keyis unique or not. Themodule_namecolumn should be shortened to'length' => '255'. This will let theSELECTqueries hit a key, and we won't have a potentially confusing ID that doesn't match up to anything else.Comment #12
herom commentedLeaving a message here, since I couldn't reach anyone on IRC.
@drumm, can you double-check that the latest "dev" version of potx is installed on the test server? I'm afraid that it might not have been re-packaged between my fix commit, and your testing in #11.
I've been able to test the same db/queries code here locally with some tricks, and it's working fine (populating
parsed_schema), so wanted to make sure.Comment #13
gábor hojtsyI wanted to help figure out the version number. The dev site does not have the original drupal.org passwords. I requested a new password (multiple times) but the email did not arrive. Finally I tried to ssh in as explained in https://www.drupal.org/node/1018084 but that is asking for a local password (which I don't believe I have, I use ssh keys to log in to d.o servers).
Comment #14
drummFrom IRC - I got Gábor's SSH access fixed and confirmed the dev site is on potx
fd41357.Comment #15
herom commentedFixed some more errors reported by @drumm.
I got a local l10n_server running (finally!), and tested this with some D8 modules (e.g. migrate_plus), and shipped config was being extracted fine. Also fixed the l10n_drupal.files connector in the meantime, and made a small fix in potx (https://www.drupal.org/node/2615930#comment-10601826) which prevented extracting schema from modules that had no shipped config.
Comment #16
drummHave you had a chance to look through this from #11?
Comment #17
herom commentedsorry, totally missed that.
I don't think there is a guarantee that
schema_keyis unique, so made them both the primary key.Comment #19
drummThe same patch, now with DrupalCI testing enabled for the project.
Comment #22
drummDrupalCI's full console output includes:
An index on each column, without a primary key, will be okay for this table.
Comment #23
drummThis patch replaces that primary key with the two indexes.
Comment #25
drummThat patch was incomplete, I missed the added file.
Comment #26
hestenetA dev site with the latest dev version of potx and @Drumm's patch applied to l10n_server is available here: https://potx-localize-localize.dev.devdrupal.org/
Comment #27
gábor hojtsyAll these docs look incorrect based on the code.
Comment #28
gábor hojtsyBTW otherwise the patch looks fine to me.
Comment #29
herom commentedFixed the docs.
Comment #31
gábor hojtsyYay, thanks! Committed this one, looking into deploying it.
Comment #32
gábor hojtsyComment #36
herom commentedComment #37
gábor hojtsyAdd deployment tag. Will do this tomorrow.
Comment #38
drummI believe this was deployed to production.
Comment #39
gábor hojtsyYes it was, thanks!