Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Default language dropdowns to user's interface language #1463

Merged
merged 12 commits into from Jun 24, 2023

Conversation

jsit
Copy link
Contributor

@jsit jsit commented Jun 22, 2023

When Markdown entry fields are shown, this change will automatically set the Language dropdown to the user's selected Interface Language.

If the user hasn't selected an Interface Language, this defaults to their browser language.

Before, this dropdown defaulted to "Undetermined", which made it so that content was by default without a language. (Hence the warning about de-selecting "Undetermined" in your list of preferred languages.)

Before

Screenshot 2023-06-23 at 5 24 36 PM

After

Screenshot 2023-06-23 at 5 21 43 PM

@snaggen
Copy link

snaggen commented Jun 22, 2023

It would be best to be able to select the default language for posts, but not sure Primary Language is a good term though since non-english speaker have another Primary Language they talk but still may post most english content. So if selection would be made, it must be clear that it is the default language for created posts, not what language the user is most fluent in.

@SleeplessOne1917
Copy link
Member

@Nutomic isn't the backend supposed to pick a language automatically if one is not specified? If so, this PR is unnecessary.

@jsit jsit marked this pull request as draft June 23, 2023 19:21
@jsit jsit marked this pull request as ready for review June 23, 2023 21:24
@jsit
Copy link
Contributor Author

jsit commented Jun 23, 2023

@SleeplessOne1917

isn't the backend supposed to pick a language automatically if one is not specified? If so, this PR is unnecessary.

No, this is for picking the language in the language dropdown when composing a post or comment. Right now that dropdown always defaults to "Undetermined".

@jsit jsit changed the title feat: Default language dropdowns to user's primary language feat: Default language dropdowns to user's interface language Jun 24, 2023
@jsit jsit merged commit dd43827 into LemmyNet:main Jun 24, 2023
1 check passed
@jsit jsit deleted the feat/default-to-user-primary-lang branch June 24, 2023 20:33
@snaggen
Copy link

snaggen commented Jun 27, 2023

I expect this to cause a lot of wrong languages for non english speaking users. If the user speaks German it is natural to have the interface in German, but still most communities are English speaking. So defaulting to German may cause a lot of posts to be posted with the wrong language.
I'd say the logic should be to only prefill the language dropdown if the user only have one lanugage selected besides "Undetermined". If the user have multiple languages selected, the language field should be empty but required, so the user is forced to select a language.

@Nutomic
Copy link
Member

Nutomic commented Jun 28, 2023

Yes this isnt correct and shouldnt have been merged. The backend tries to select a language automatically if none was passed, and this change is going to break the automatic language selection.

@jsit
Copy link
Contributor Author

jsit commented Jun 28, 2023

@Nutomic Thanks, my mistake, this was too aggressive. I’ll create a PR to revert this.

@jsit
Copy link
Contributor Author

jsit commented Jun 28, 2023

@Nutomic Why does the backend dictate what language the user is writing in? This PR affects the markdown language select drop-down. I imagine the language the user is writing in won’t always be the language the server is in, no?

Will still back this out but am curious about this behavior.

jsit added a commit to jsit/lemmy-ui that referenced this pull request Jun 28, 2023
@Nutomic
Copy link
Member

Nutomic commented Jun 28, 2023

Its not dictating anything. A default language is only picked if the overlap of user languages and community languages contains a single item (excluding undefined). So only if there is a single valid possibility. Here is the relevant code. You could reimplement it in the frontend to pick a default language when possible. Similarly, language options could be removed from the dropdown if they are not allowed in the community.

For comments, the language always defaults to the language of the parent post/comment if none was provided explicitly. This logic could also be reimplemented in lemmy-ui. Although it can be incorrect in some cases as well.

@jsit
Copy link
Contributor Author

jsit commented Jun 28, 2023

@Nutomic Ohhh, I see. The dropdown still says "Select Language" (no language is selected), but the content will be saved with the language that matches the criteria you listed. I was confused because the dropdown never changed; I thought I was just always posting in the "undetermined" language.

jsit added a commit that referenced this pull request Jun 28, 2023
@snaggen
Copy link

snaggen commented Jun 28, 2023

I didn't realize the backend had this default selection of languages either, so that is a bit confusing.
I'd rather see that selection also happening in the UI, and then having the language selection mandatory and leave it empty for the case where it cannot be auto-selected (ie. when use have more than one language selected, besides "undetermined").

@Nutomic
Copy link
Member

Nutomic commented Jun 28, 2023

Making language selection mandatory would be very annoying, and would discourage users from posting. In any case there will be posts without language tag, because most other federated platforms dont support language tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants