question

Kim Strasser avatar image
Kim Strasser asked

How can I use different languages in ban reason?

I want to add the ban reason in German, French and English. How can I do that? 6509-bildschirmfoto-2023-11-09-um-141631.png

In my game, I use the following code to get the ban reason and I want to display the ban reason in the player's language.

 var result = await PlayFabClientAPI.LoginWithIOSDeviceIDAsync(new LoginWithIOSDeviceIDRequest()
             {
                 DeviceId = playerdeviceid,
                 CreateAccount = createaccount
             });
    
 var result = await PlayFabClientAPI.LoginWithAndroidDeviceIDAsync(new LoginWithAndroidDeviceIDRequest()
             {
                 AndroidDeviceId = playerdeviceid,
                 CreateAccount = createaccount
             });
    
 // or:
    
 var result = await PlayFabClientAPI.LoginWithEmailAddressAsync(new LoginWithEmailAddressRequest()
             {
                 TitleId = titleid,
                 Email = keyboardtextloginemail,
                 Password = keyboardtextpassword
             });

And then I get the ban reason like this but I don't know how to get the ban reason in the correct language:

 string errorline = string.Empty;
 if (result.Error.Error == PlayFabErrorCode.AccountBanned)
 {
                     var kv = result.Error.ErrorDetails.First();
                     var BanReason = kv.Key;
                     var BanExpirationDateAndTimeUTC = kv.Value[0];
    
                     if ((language == "fr") || (language == "de"))
                     {
                         if (language == "de")
                         {
                             errorline = BanReason;
                         }
                         else
                         {
                             errorline = BanReason;
                         }
                     }
                     else
                     {
                         errorline = BanReason;
                     }
 }

How can I display the ban reason in the player's language in my game?

Account Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Infer Wang avatar image
Infer Wang answered

One possible way is putting all three languages in the ban reason if you don’t mind displaying three languages in client side. Another solution is that you can write encoded reason in the ban reason. Then in your client side, decode the reason and display the language according to the users’ preferred language.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.