Problem/Motivation
We want to showcase Drupal's multilingual capabilities in Umami, but Umami currently only imports content in one language.
This issue is to change the structure of files and folders under demo_umami_content to better store multiple languages.
Proposed resolution
Add a subfolder demo_umami_content/default_content/languages/en
Move article_body, recipe_instructions, articles.csv, pages.csv, recipes.csv folders within this new folder
Move the term definitions to their own CSV files per vocabulary so they can be referenced by row number, making it possible to cross reference terms across languages.
Update content import code to use this new structure.
After implementation, the imported content should be identical to as it would be without this patch. But it we can then proceed in another issue to start adding the corresponding es folder and updating the content import to import translated content.
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | restructure-default-content-3028627-28--30-interdiff.txt | 6.52 KB | smaz |
| #30 | restructure-default-content-3028627-30.patch | 36.56 KB | smaz |
| #28 | interdiff_27-28.txt | 471 bytes | shaal |
| #28 | restructure-default-content-3028627-28.patch | 36.47 KB | shaal |
| #27 | restructure-default-content-3028627-27.patch | 36.46 KB | shaal |
Comments
Comment #2
rakesh.gectcrComment #3
rakesh.gectcrAs initial patch, moved all the english content from
/default_content/article_body/ to /default_content/languages/en/article_body
/default_content/recipe_instructions/ to /default_content/languages/en/recipe_instructions
After moving that, installed it in my local, looks ok,
Comment #5
rakesh.gectcrJust fixed the test and enabled the Spanish language
Comment #6
rakesh.gectcrSorry forgot to add the interdiff. :)
Comment #7
rakesh.gectcrRemoved the language configuration, applying the only the test fix,
Comment #10
penyaskitoAdded parent issue.
Comment #11
eli-tChanging parent issue to #3028769: [META] Showcase Drupal's Multilingual Capabilities by implementing Umami in a 2nd language (Spanish)
Comment #12
eli-tThis is just a reroll of #7 to make it apply now chocolate-brownie-umami.html is renamed to vegan-chocolate-nut-brownies.html.
Comment #13
eli-tComment #15
eli-tFixed tests. Hopefully.
Comment #16
eli-tMore work in progress - this splits the taxonomy terms out in to their own file so that they can be translated and crossed referenced between languages by their row number in the CSV.
The tag references in the articles/recipes CSVs are now integer references to the row numbers in the tags.csv, so the next step is to change the import code for the articles and recipes so it doesn't create the tags on the fly when creating nodes, but instead looks them up from those already created.
Comment #17
eli-tThis patch builds on the previous patches and removes all the just in time generation of terms from the recipe_category and tag vocabulary during node import. Now they are all generated in advance, and mapped from the recipes/articles files to the taxonomy files by row number. This makes it easier to cross reference taxonomy terms across languages.
Comment #19
eli-tTriggering retest
Comment #21
eli-tComment #22
eli-tComment #23
shaalI tested it and saw that all content is imported as it should from the new location
/languages/en/.Comment #24
eli-tComment #25
shaalI tested Umami's content again.
I installed Umami in English and went through every piece of content and each taxonomy.
Later I installed Umami in Hebrew, to make sure that another language doesn't cause any new issues.
For the end user - everything looks the same as it was before the patch.
The file structure has all the content files under
/languages/en/Comment #27
shaalI fixed patch #17 by manually applying the changes in
InstallHelper.phpComment #28
shaalpatch #17 was created for 8.6.x
regular
git apply -v 3028627_17.patchwould fail with the messageI found here https://www.drupal.org/patch/reroll#comment-8964453 about
--3wayoption in git.so running
git apply -3 3028627_17.patchresulted in
Now all the files were staged, except for the merging conflict.
using GitKraken (which is awesome!) I could see clearly how to merge between the conflict of changes in the file since 8.6.x, and changes that are coming from the patch itself.
I found out that I missed 1 line of space, so I submitted this new patch.
I will RTBC it because there were no changes made since patch #17, just resolving a merge conflict.
Comment #29
gábor hojtsyLooks great, except:
I find it strange that we hardwire numbers into the other CSV files referring to these terms, but then autogenerate those numbers programatically elsewhere. It would be more consistent if we would include the numbers in the terms files as well, and just use them in the code too.
This feels fragile even if I cannot exactly cite a situation where it would badly break, it feels like better to include the ID we use to refer to it rather than inferring it given that the files are hand-edited.
Comment #30
smazUpdated to add IDs to the terms, so it's not reliant on row numbers matching up.
Comment #31
kjay commentedThis latest patch installs without errors. Taxonomy terms are present as expected. Each term returns the tagged content on the term pages. The articles and recipes continue appear as expected.
Comment #32
shaalPatch #30 works great.
I tested it as is,
then I created multiple modifications:
It was working as intended and didn't produce any errors. On Umami itself - all taxonomy links behaved as expected, and nothing was linked to 404 pages.
Comment #34
gábor hojtsyYay thanks! Committed. Let's get the translations (and their loading and exposure) happen next!