If the site is not multilingual and user subscribes to a newsletter then no 'langcode' is saved in database table 'simplenews_subscriber'.
This causes unexpected behavior with custom code as 'langcode' column is blank.

Similar to other entities it should have saved the default language of the site, like other entities.

Comments

gulab.bisht created an issue. See original summary.

gbisht’s picture

Status: Active » Needs review
StatusFileSize
new529 bytes

Here is a patch to save websites current language which will be the default language for the websites which are not multilingual.

adamps’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Needs review » Postponed (maintainer needs more info)

Hi thanks for the patch.

You have set this issue as a bug. Please can you update the issue summary with the symptoms or problems that you have found?

gbisht’s picture

Issue summary: View changes
gbisht’s picture

Status: Postponed (maintainer needs more info) » Needs review

This situation of blank 'langcode' column causes issues with custom queries and code. It will be a good thing to save the site language as it is also the behavior of other core entities.

adamps’s picture

Category: Bug report » Task

Thanks. So if I understand correctly the motivation is to make it easier for you to write custom code and to be consistent with other entities. In that case I think the category should be "Task" not "Bug".

Please can you add the patch again now I have changed the version to 2.x? In fact I've just checked the code and this might even already be fixed on 2.x so please take a look.

gg24’s picture

StatusFileSize
new815 bytes

Hi @AdamPS and gulab.bisht,

Please have a look at the patch attached with a change. Please review.

Thanks!

adamps’s picture

Status: Needs review » Needs work

@gg24 thanks for the patch. However I don't understand - please can you explain?

The default is $preferred_langcode = NULL in which case the existing code ?? should work correctly.

As I said in #6

this might even already be fixed on 2.x so please take a look.

Are you sure that it doesn't already work in 2.x?

adamps’s picture

Status: Needs work » Closed (outdated)

This has been fixed in the current code