TC
Twill CMSdan__devine

Multilingual Imports (3.x)

Running into two issues when running a bulk import from (many) xlsx files (on the command line using Maatwebsite Excel) . I'm porting over a tonne of content from two (very shaky) WordPress websites built by a third party which were essentially duplicates running alongside each other, one in DE and one in EN (not a great architecture). The goal is to combine the two into a consolidated site on Twill. There are thousands of different posts of various types coming over so manually adding them would obviously be a very bad option). I have one stack of import files for, (eg) blog posts from the english site and one stack from the German site. These aren't translations of each other (although some are to add some extra complexity). Both are then to be imported to Twill into one module, some with DE as the primary language, some with EN as the primary language. I am also trying to preserve the original slugs so they are being populated too, and a custom block is being populated and added for good measure πŸ™‚ The first screenshot is the rough and ready generic class I'm using to manage the imports across a bunch of different modules. This works perfectly when used on the EN posts (the state of the class in the screenshot is where I'm trying to import the DE correctly). The posts and slugs populate and the DE version is inactive when imported, which is what I want (screenshot 2). The problem is, when I import the DE only content the empty EN version is always live too. And the UI looks like the third screenshot (blank titles). I've tried many combinations of active/disabled but ultimately end up with the same result. Issue 1 (most pressing) is that EN is always live and issue 2 is the UI not showing a title for the DE only posts (which makes sense as the title is a translated field but is something I need to work around) We're at the point in a massive project where I am very likely to be making basic mistakes that hopefully fresh eyes might spot πŸ™‚
No description
No description
No description
D
dan__devineβ€’23d ago
to clarify - this is obviously not intended Twill functionality or a bug, just a use case where I've run into problems - apologies if this is in the wrong place.
I
ifoxβ€’23d ago
ha, been there! Hi @dan__devine for the empty title you can use an accessor to implement a fallback in English for DE only records for the English always being active, that's interesting. From the UI, are you able to create a DE only record?
D
dan__devineβ€’23d ago
Hi @ifox - ha, yes of course that makes perfect sense, thank you. When created in the UI the DE posts behave correctly, its just when imported. I'm currently picking through handleTranslations to see why this would be but haven't spotted any reason so far. Might need to look at HandleSlugs next.
I
ifoxβ€’23d ago
which version of Twill are you on? Check the network request payload when you create a DE only record. If you pass the same structure to the repository, it should do the same thing. but create and update calls may have different behaviors, so it might be that you'd need a create followed by an update call to make it work. Or you could directly use the model or DB, tbh, as I'm assuming you won't need to run this anymore after the launch of the Twill based sites.
D
dan__devineβ€’23d ago
I'm on 3.2.1, and I'm very much hoping not to have to do this again although someone has mentioned that a third Japanese site may exist 😨 . Will move to the direct approach if I can't figure this out, but I'm hopeful that if I can clear this hurdle I might be able to make a Twill specific wrapper for the Maatwebsite package to help others (and myself) in the future as more people migrating from multilingual CMS seems likely. Following create() with update() made it all work, thank you so much for the help and nudge in the right direction @ifox
I
ifoxβ€’23d ago
awesome!
Want results from more Discord servers?
Add your server
More Posts
Upgrading custom form fields from 2.x to 3.x?I noticed after upgrading Twill to 3.x from 2.x that my custom form fields no longer work. Is there Tags in create modalHello! Is it possible to have Tags input in create modal form? Last time I tried, it threw an error.How to get all data from repository?I wanna get all models from repository and show. How to get all data?How to use random links to browser field?I wanna add random link to browser field. How to do that?DatePicker is not working.I have added DatePicker to form builder. And added column to table, field to model... But when I savSave images in multple sizes for responsive?Hi Support Team, I would like to ask if Twill can store the images in multiple size for desktop, mobHow to display image from InlineRepeaterI want to dispaly the image from InlineRepeater. Please help me how to do it.how to upgrade twil 1.2.1 to latest versionhow to upgrade twil 1.2.1 to latest version twill cmsMulti-Select from Dynamic ValuesI created Location Model. And each location has multiple tags. I want to share tags across differeHow should I migrate from Legacy Settings to V3 Settings?I am having trouble accessing the setting goroup I created. When do php artisan route:list, settingCannot use connectedTo: Cannot unpack array with string keysHi I am having issues getting connectedTo to work in my Block. I have Twill 3.1.0 installed, but whasynchronous request in selectGood afternoon, I have two select fields. The thing is that when selecting the first select field, IUpgraded from Twill 2.13 to 3.2, frontend error when saving a module that uses 'editInModal' => trueI upgraded from Twill 2.13 to 3.2. When saving a module that is created/edited via a modal (using $iUpgraded from Twill 2.13 to 3.2, raw HTML links visible in browserHi, I upgraded from Twill 2.13 to 3.2. I am now seeing raw HTML edit links in my "Projecttags" browHow to use Conditional Fields in ControllerI want to add a Author select fields when shared_by === user ` $form->add( Radios::maBlock editor preview Vite issue?Hey all, I'm getting this when I preview a page module block editor in the admin:Upgrading from 2.0 to 3.0 -Block Editor $groups issueHello! I'm getting a strange error (see picture). I've tried clearing all caches. It only happens onInline Repeater get's overridden by another InlineRepeater with the same name in another block.The code in first image get's overriden by the code in the second image in admin panel. Normally, whTable custom columnHello! I created module Product and relationship with module Category. I would like to display categMulti select selected issueIn twill3 I created 2 CRUD, ImportedItem and ItemTypes. I used Multiselect for selecting ItemTypes.