< 162023-01-17⋎18 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
12:16FarmerEd[m]mstenta: should untranslatable content have `"langcode : en"` at all?
12:17FarmerEd[m]`"langcode : und"` and `"langcode : zxx"` both work for patching in all languages
12:17FarmerEd[m]und = Not Specified
12:17FarmerEd[m]zxx = Not Applicable
12:18FarmerEd[m]but the original log needs to have und or zxx set before trying to patch with the API
15:46mstenta[m]Farmer Ed: good question!
15:47mstenta[m]i don't know enough about the localization subsystems to know what's "right"
15:48mstenta[m]> `"langcode : und"` and `"langcode : zxx"` both work for patching in all languages
15:48mstenta[m]this is really good to know!
15:48mstenta[m]i wonder what currently determines the default language that gets set when new entities are created
15:49mstenta[m]i imagine Drupal just uses the default language of the site... but i wonder if there is a "recommended" way to say "always use und"
15:49mstenta[m]or if that would be considered a "hack" as well
15:50mstenta[m]i'd like to understand the proper way to do things before we make any code changes... although based on that d.o issue there may not be a "proper" way persay
15:52*uploaded an image: (13KiB) < libera.ems.host/_matrix/media/v3/downloa >
15:52FarmerEd[m]It can be set in the UI anyway
15:52mstenta[m]ah ok... which i imagine means it can also be set in yml on a per-type basis
15:53mstenta[m]this feels like something we should bring to the experts in Drupal Slack #multilingual :-)
15:54FarmerEd[m]Can't say I was aware of those #experts, but sounds like the right group 😄
15:56mstenta[m]i know just enough about the ins-and-outs of drupal's localization systems not to trust any quick fixes 😅
15:56mstenta[m]but maybe that's all we'd need to do!
15:57FarmerEd[m]I know you said farmOS does not support content translation but did you set something to prevent content language change via the API?
15:57mstenta[m]i don't think i did
15:58mstenta[m]basically all of the "decisions" we've made (or haven't made) are encapsulated in this module: github.com/farmOS/farmOS/tree/2.x/module
16:00FarmerEd[m]When langcode is set to undefined or not applicable, you can set it via the API but once it is set to a language you cannot. It says not allowed to change langcode
16:00mstenta[m]there is code to prevent changing the DEFAULT language of the site
16:00mstenta[m]because of the issue we discovered... described in that d.o link i posted in the forum topic
16:00FarmerEd[m]But this is just of that entity
16:01mstenta[m]but default languages of each entity aren't touched
16:01mstenta[m]i do like the idea of just making the default language "undefined" for all farmOS entities
16:02FarmerEd[m]Also changing langcode to the langcode of the user allows patching
16:03mstenta[m]although changing all of them everywhere isn't exactly simple... we would have to change all the YML configs, make sure that gets reverted everywhere, add an update hook to change all EXISTING entities to und... and then there's also contrib modules that add their own types
16:03FarmerEd[m]I was wondering about the existing logs if we do that. But maybe there is not that many foreign language users using API functions.
16:04mstenta[m]so i would want to be very confident that this won't break anything else
16:04FarmerEd[m]👍
16:04mstenta[m]i also wonder about that if statement that causes the error in the first place...
16:04mstenta[m]it seems like it was recently tweaked in core to fix another issue... maybe it's just still not perfect
16:05mstenta[m]but i think that gets back to the bigger question that seems to "active" in drupal.org about how all this stuff *should* work
16:05mstenta[m]it seems to me that in Pat's case, updating a log that has a langcode of en should be allowed, even though his user's default language is nb
16:07mstenta[m]i can understand preventing that if you are working with content translations... but if you're not?
16:07mstenta[m]and even with content translations... shouldn't a user be able to use multiple languages? who cares what his default is?? shouldn't he be able to update anything he wants?
16:07mstenta[m]so i still have some deeper questions :-)
16:08mstenta[m]one aspect to this that i didn't go into detail about in the forum topic is: "language negotiation"
16:08mstenta[m]that's basically the way that drupal is configured to decide "which language to use"
16:08mstenta[m]and we have some control over that... we explicitly set that configuration via the farm_l10n module
16:09mstenta[m]it's basically a way of configuring the order of preference for which language is used
16:09mstenta[m]github.com/farmOS/farmOS/blob/b99f46cce4
16:10mstenta[m]our config is basically: "if the user has a default language, use that. otherwise use the site default"
16:10mstenta[m]i think that's what's setting nb in the code that ultimately throws the error
16:11symbioquine[m]Yeah, I'm not quite sure how well the default CMS/site-builder oriented language logic will map to farmOS...
16:11mstenta[m]so maybe there's an opportunity to change it there too
16:11symbioquine[m]The interface translation stuff seems like the easy part
16:11mstenta[m]symbioquine: exactly... we have slightly different requirements
16:12symbioquine[m]* like the "easy, * easy" part
16:12mstenta[m]and i assume a lot of the logic in drupal core has focused more on the content translation side of things
16:12mstenta[m]so we are bringing more of the interface voice :-)
19:02mstenta[m]@penyaskito in Drupal slack seems to suggest it's a core bug:
19:02mstenta[m]> I would need to debug this, but `nb` should be the INTERFACE language, but if content is all `en` not the CONTENT language. So I guess that's definitely a bug and not an issue in your config
19:05FarmerEd[m]But is it a core issue that's been bounced around for years?
19:06mstenta[m]Oh no doubt
19:06mstenta[m]lol
19:06mstenta[m]Better question: are any core issues NOT bounced around for years? 😆
19:07mstenta[m]Just joking... it sounds like this might be one that is newly discovered by us perhaps
19:32FarmerEd[m]Who found that can of worms...🤣
19:32mstenta[m]Credit where credit is due postmanpat
19:33mstenta[m]Getting some really good info and ideas/recommendations from @penyaskito...
19:33FarmerEd[m]Well he certainly has a knack for them anyway
19:33mstenta[m]I'll copy the chat into the forum when it's concluded
19:45FarmerEd[m]Well, he's not wrong, enabling content translations does work
19:48mstenta[m]ah you're following along! haha
19:48mstenta[m]i think we may have a good solution to try!
19:48mstenta[m]hook_entity_bundle_info_alter
19:55FarmerEd[m]<mstenta[m]> "ah you're following along! haha" <- I thought you'd figured that out already 😁
19:56mstenta[m]bah there's no way to get a slack chat transcript???
19:56mstenta[m]slack is utterly useless
19:58mstenta[m]Farmer Ed: do you still have a testing env set up?
19:58mstenta[m]if i sketch up a bit of code would it be easy to try it out?
19:59FarmerEd[m]yes, assuming un-installing content translations breaks it again
20:00mstenta[m]oh yes do that first :-)
20:06mstenta[m]ah i gotta run and pick up the kids...
20:07mstenta[m]this is what i would have you try... in `farm_l10n.module`:... (full message at <libera.ems.host/_matrix/media/v3/downloa>)
20:07mstenta[m](assuming you are testing with a lab_test log... adjust accordingly if not)
20:07mstenta[m]back later!
20:17FarmerEd[m]it works!!!!
20:19mstenta[m]Wow awesome!
20:20mstenta[m]So we basically just need to do that for all entity types+bundles
20:20mstenta[m]But also wrap it in a condition so that it only runs if the content translation module is not installed
20:20mstenta[m](And copious comments to explain why)
20:20FarmerEd[m]cool
20:21FarmerEd[m]Do they all need to be specified individually?
20:22FarmerEd[m]or just types?
20:23mstenta[m]I think a foreach would do :-)
20:23mstenta[m]Question is: should we do it for ALL entity types?
20:23mstenta[m]I imagine it would be OK to?
20:24mstenta[m]> But also wrap it in a condition so that it only runs if the content translation module is not installed
20:24mstenta[m]As long as this condition is there, theres an escape hatch for anyone that actually needs it
20:25FarmerEd[m]And anyone who needs it has no issue as long as this code is not applied
20:26mstenta[m]Exactly. Thats what it sounds like
20:27FarmerEd[m]mstenta[m]: Don't we need to, all entities should be modifiable via the API
20:27mstenta[m]Yea I don't see any reason not to
20:28mstenta[m]I didnt look closely at what other entity types were included before I left
20:28mstenta[m]But that hook should only include content entities with bundles
20:29mstenta[m]So I think its safe
21:19*wildhavenfarm[m] has joined

< 162023-01-17⋏18 >