Open klonos opened 2 years ago
// Because this update may adversely affect sites that once were multilingual
// but are now mono-lingual, we only apply if we're absolutely sure only a
// single language is used, both in the configuration and in the node table.
Can someone please explain that logic ^^ to me? Why are assuming that there may be previously-multilingual sites that have been converted to monolingual (and how do we accurately and with absolute certainty tell that?), and why are we not considering how this may affect sites that start as monolingual, but may at some point in the future evolve to be multilingual?
Also, what is "adversely affect" referring to? Can someone provide one or more use cases where there is an actual problem? (that cannot be solved while at the same time making sure that a language is specified)
I'm not arguing with your reasoning, but just want to point out that, as a coder who has written many custom modules with forms for my sites for several years in D7 and now, porting them to Backdrop, if we proceed with the change you are proposing, all my modules that access fields -- you know, the usual field_name[LANGUAGE_NONE][0]['value']
-- in all my form submit and #default_value
etc, etc, etc will now be broken. And this would be really bad.
What is to gain by this change? Unless I'm misunderstanding...?
To clarify: I'm not proposing that we arbitrarily change things without careful planing. See how I also said "If that breaks things ..., then we should also fix all these broken things."? ...what I meant was that we should make sure that the change is as "transparent" as possible, and as backwards-compatible as possible. We're all a smart bunch I trust, so we'll figure things out; I'm sure 🙂
In general it seems to make sense to tag content to the language it is, I agree. But, one thought to add on current/default functionality: if you have a monolingual site and then add a new language, at the moment all existing content (und
) will show up in both languages. If your monolingual site specifies a language code for all content and then you add a new language, you'll see a completely empty site when browsing the language-specific URL. (This particularly comes into play when you are adding translation capability but only plan to translate a small number of specific pages and use the default content for everything else -- once you flip over to one of the few translated pages the site tries to keep you on the second language version, which will show nothing for most of the website.)
Thanks for chiming in @laryn 🙏🏼 ...the scenario/situation you describe is a perfectly valid one, and it could end up in undesired behaviour. However, I was under the impression that we provided an option to fall back to the site default language (original language the content was created in) if the content was not yet translated to the language being viewed. Right? If we don't provide that option, then we should.
So this seems like a workflow issue to me (making some assumptions for now - I will need to test how the defaults are configured in Backdrop OOTB). Consider the following scenarios:
How we could improve things further in the second scenario is if we displayed a "not translated yet - content shown in its original language" message if we fall back to the default/original language.
Personally, I'd vote for LANGUAGE_NONE. I have both, monolingual and multilingual sites and the language neutral approach causes less work.
This is a related setting provided by i18n
:
Thanks @laryn 🙏🏼 ...I haven't used i18n in a while, so I wasn't aware (or had forgotten) about that option. It's a bit confusing why the default option is not also the recommended 🤔
...the language neutral approach causes less work. @indigoxela can you please elaborate on that with some examples please?
@laryn pretty much describes the use-case:
This particularly comes into play when you are adding translation capability but only plan to translate a small number of specific pages and use the default content for everything else.
5498 brought me to #903, which at the time it was committed I could not understand. Now that I know more, I have to ask: why not be setting the language to whatever the language that the site was originally installed is? If additional languages are added in the future, the language of existing content/aliases would need to be updated anyway (because none/und will not be technically true then).
From #903:
That sounds like a bug that we should fix - it shouldn't be a reason to propagate something that is technically inaccurate. Right?
Right! Seems to me that Backdrop/Drupal 8 are doing the correct thing 👍🏼
It seems to me that
node_update_1010()
should be removed, and that we should add a new update hook that fixes things for monolingual sites that have already been upgraded to Backdrop. If that breaks things (because we have been doing the wrong thing - in order to accommodate the change innode_update_1010()
), then we should also fix all these broken things.My point is that even in monolingual sites, everything should have a language, because:
...unless we make sure that when a second language is added, we go through all content/aliases etc. and update them to actually have a language.