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

Fix regional language variants not being properly accessed #152

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

Tmpod
Copy link
Contributor

@Tmpod Tmpod commented Jun 3, 2023

I noticed there was a problem when I visited the main project page in incognito, where the recommended instances were not matching those defined for my language (pt-PT). Turned out, recommended_instances.json only had pt and pt_BR.

There was another issue, however. The browser reports languages with dashes, while the i18n registry had codes with underscores. I changed the values to comply with browsers, and it all works correctly now.

This is not the ideal fix. It would be better to have some sort of fallback system where it tries to find the best match for the language reported by the browser. So, for example, if I visited the website in pt-PT but it didn't have it, it would first try to match the more general language code pt, before trying to find another regional variant like pt-BR. Something for a later PR though.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but remove that instance_stats from this PR.

@Nutomic
Copy link
Member

Nutomic commented Jun 5, 2023

A better solution would be to take only the first part of the language string (eg pt) and compare that. I dont think it makes sense to distinguish by the full pt-PT for now. Anyway merging this.

@Tmpod
Copy link
Contributor Author

Tmpod commented Jun 5, 2023

I can't seem to be able to read the details on that failed job.

@Nutomic Nutomic merged commit 47d546d into LemmyNet:main Jun 5, 2023
@Nutomic
Copy link
Member

Nutomic commented Jun 5, 2023

This time it worked.

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

3 participants