Skip to content

Arguments for Push Message localisation in SendExchange do not seem to work #98

Description

@michaelclockstone

Sending an Exchange with the GKTurnBasedMatch.SendExchange method with a localisation key that is set in the Localizable.strings and one or more arguments leads to a push message that only displays the localisation key (in my example LC_PushMsg_MatchEnded). If the message does not contain arguments the push message is correctly localized and displayed.

Example of localizable.strings entry with one argument to be replaced:

"LC_PushMsg_MatchEnded" = "The match has ended. The winner is %@";

I also tried

"LC_PushMsg_MatchEnded" = "The match has ended. The winner is %1$@";

I even added a log to the swift file to make sure that exactly one argument is passed to the native SendExchange method (for this example) and the call seems to have the right argument.

Activity

  1. self-assigned this
    on Jun 1, 2026
  2. michaelclockstone commented on Jun 2, 2026

    @michaelclockstone
    Author

    I am sorry for the confusion, but it seems that localisation of Push Messages generally does not seem to work (not only if there are arguments). Or maybe there is something I am doing wrong. I wrote my own post process script that copies the Lozalizable.string files to the XCode project and they end up in the IPA file in the root folder of the .app

    string projectPath = PBXProject.GetPBXProjectPath( buildPath );
    
    var project = new PBXProject();
    project.ReadFromFile( projectPath );
    string targetGuid = project.GetUnityMainTargetGuid();
    subPath = subPath.Replace( '\\', '/' );
    
    foreach(var lang in localisations.Keys)
    {
        string lproj = lang + ".lproj";
        string folderPath = Path.Combine( subPath, lproj );
        string fileGuid = project.AddFolderReference( folderPath, folderPath );
    
        project.AddFileToBuild( targetGuid, fileGuid );
    }
    
    project.WriteToFile( projectPath );
    

    I believe that my files and the itegration are correct, because if I add a test log it is correctly localized:

    NSLog(@"%@", NSLocalizedString(@"LC_PushMsg_Score_Improved", nil));

    Only GameKit push messages do not localize.

  3. ryzngard commented on Jun 2, 2026

    @ryzngard
    Collaborator

    Thanks for the clarification @michaelclockstone ! I'll do some digging to see if this is Unity specific or also applies to other GameKit games.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions