Skip to content

Respect local language settings first #1420

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

d47081
Copy link

@d47081 d47081 commented May 16, 2025

Solution for #1407

@d47081
Copy link
Author

d47081 commented May 16, 2025

The settings are not saving after the application restarts, and I don't know yet where to save them properly.

@GeopJr
Copy link
Owner

GeopJr commented May 16, 2025

Not sure how to approach this... As mentioned in #1407 we save and load it from the server so it syncs across clients but I was under the assumption that snac2 would return null or an empty string since it doesn't support it but it seems that it always returns 'en':

{
    "id": "2d49d7e26c495b8ceea54d6011b5d44c",
    "username": "awoo",
    "acct": "awoo",
    "display_name": "awoo",
    "created_at": "2025-05-16T07:34:22Z",
    "last_status_at": "2025-05-16T07:34:22Z",
    "note": "",
    "url": "https://127.0.0.1/awoo",
    "locked": false,
    "bot": false,
    "emojis": [
    ],
    "avatar": "https://127.0.0.1/susie.png",
    "avatar_static": "https://127.0.0.1/susie.png",
    "header": "",
    "header_static": "",
    "source": {
        "privacy": "public",
        "language": "en", // <---
        "follow_requests_count": 0,
        "sensitive": false,
        "fields": [
        ],
        "note": "",
        "bot": false
    },
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 0
}

so there's no real way of having a fallback if every time we sync we get a valid language value :/

@d47081
Copy link
Author

d47081 commented May 16, 2025

Yes I saw your Issue https://codeberg.org/grunfink/snac2/issues/388

  1. Does Tuba support GSettings or any other local storage?
  2. I expect from settings global behavior, so that's related to active (multi) account so?

Can we keep the settings somewhere like:

settings.bind ("collapse-long-posts", collapse_long_posts, "active", SettingsBindFlags.DEFAULT);

@GeopJr
Copy link
Owner

GeopJr commented May 16, 2025

Yes I saw your Issue

The problem here is not exactly just the saving part. When you 'activate' an account, we set the default language from the server. snac2 returns 'en' regardless, so the only solution here is removing the sync mechanisms which I won't do. snac2 is the one who needs to supports this and not us removing it :/

For your questions, both are yes. Settings in code live here https://github.com/GeopJr/Tuba/blob/main/src/Services/Settings.vala But it's a bit more complex than usual. There are both global settings and per-account settings, all saved in gsettings. Depending on what you want to do, you might need to use either the global ones or the per-account ones.

Here's an example commit of adding a new setting 86b0075 (notice that it has to be added to the gschema file, it requires a vala property and it needs to be added to the array with the other strings to initialize and bind it)

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.

2 participants