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

Missing translations for the string "<software> wants permission to update" in SPUInstallerDriver.m #2607

Open
luc-guyot-infomaniak opened this issue Aug 8, 2024 · 5 comments

Comments

@luc-guyot-infomaniak
Copy link

luc-guyot-infomaniak commented Aug 8, 2024

Summary

The translations of the authorizationPrompt string found in Sparkle/SPUInstallerDriver.m are missing:

    // Changing this authorization prompt is a little complicated because the
    // Auth database retains and caches the right we use, and there isn't a good way
    // of updating the prompt. See code in SUInstallerLauncher.m
    // For this reason, we don't provide localized strings for this prompt yet
    // (and I believe, the authorization framework has a different way of specifying localizations..)
    NSString *authorizationPrompt;
    if ([mainBundleName isEqualToString:hostName]) {
        authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update.", hostName];
    } else {
        authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update %2$@.", mainBundleName, hostName];
    }

Example. Missing french translation.

image

Possible Fix

Re-instate former translations or translate the strings with missing translations.

Version

This issue impacts at least 2.6.2 and 2.6.4.

@zorgiepoo
Copy link
Member

zorgiepoo commented Aug 8, 2024

Read the surrounding comments around this code for why localizations are not provided today for this message.

I'm not sure this is going to get fixed. It requires a deeper investigation to internationalize.

@luc-guyot-infomaniak
Copy link
Author

Read the surrounding comments around this code for why localizations are not provided today for this message.

I'm not sure this is going to get fixed. It requires a deeper investigation to internationalize.

Thanks for your prompt reply and insight. Indeed, I should have included the comment you are referring to, that is:

    // Changing this authorization prompt is a little complicated because the
    // Auth database retains and caches the right we use, and there isn't a good way
    // of updating the prompt. See code in SUInstallerLauncher.m
    // For this reason, we don't provide localized strings for this prompt yet
    // (and I believe, the authorization framework has a different way of specifying localizations..)

@Eitot
Copy link
Contributor

Eitot commented Oct 16, 2024

I was curious about this. According to the documentation, AuthorizationRightSet() provides its own localisation mechanism by using the value of the descriptionKey argument which is either a localised key or a string. The last two arguments (bundle and localeTableName) control the source of the localised string (by default: NSBundle.mainBundle and Localizable.strings if NULL is passed). Has this not worked?

See also: https://developer.apple.com/library/archive/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110-CH1-SECTION8

@zorgiepoo
Copy link
Member

It's worth trying. I just don't think I looked into it (I last looked at this in 2016 and skipped it).

The bundle passed in will need to be Sparkle's bundle. If an app is sandboxed using the installer XPC Service, it will be in a different path. pathForBundledTool:extension:fromBundle: does something similar to determine paths.

I may not want to support localizations if the system caches the strings for the passed in auth right. Such that, I don't want to populate a different right each time a localization is updated. So this requires a bit of investigation.

@zorgiepoo
Copy link
Member

zorgiepoo commented Oct 21, 2024

I think the "cache" is because AuthorizationRightSet() is only used when AuthorizationRightGet() returns errAuthorizationDenied. However if I experimentally change it to always set the right without the get call, I see two prompts show up. I don't really remember the semantics but I guess the check is there for a good reason (indeed this is what the linked guide does).

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

No branches or pull requests

3 participants