FBSDKLikeControl标题文本与设备语言环境不同步,如何解决?(涉及FBSDK和iOS技术)

9

我在项目中使用了FBSDKLikeControl,并期望'like'和'liked'文本根据设备所在地区语言(ar-AE)进行更改。但实际上,语言环境并没有按照预期更改,仍然显示英语文本而不是阿拉伯文本。

self.buttonFBLike = [[FBSDKLikeControl alloc] init];
self.buttonFBLike.center=self.view.center;
self.buttonFBLike.likeControlStyle=FBSDKLikeControlStyleBoxCount;
[self.view addSubview:self.buttonFBLike]
// Share url like @"https://www.facebook.com/FacebookDevelopers"
[self.buttonFBLike setObjectID:shareURL];
self.buttonFBLike.enabled=YES;
[self.buttonFBLike isTouchInside];

请问有人能建议我如何通过编程设置FBLikeButton的语言环境吗?


你能展示一下你的代码吗? - Anbu.Karthik
2个回答

2

1
你在上一行中的堆栈溢出链接里找到了这个答案,但是我以为那是 FBSDK 本地化链接,所以之前跳过了。非常感谢。 - Manobala
是的,@manobala,你说得对,我也有同样的想法,这是FB开发者页面链接,如果我之前注意到了,我可以编辑这个答案或者只是发布更改日志链接,干得好Yann Kaiser,继续保持 :) - Balakrishnan Mca
请问如何在程序中设置 FBLikeButton 的本地化呢? - Manobala

1
你的编程部分是正确的,添加了可选的FacebookSDKStrings.bundle以为国际应用程序提供本地化字符串,因此您需要将FacebookSDKStrings.bundle包含到您的项目中,并且对我来说它可以正常工作。
以下内容位于FacebookSDKStrings.bundle en.lproj(FacebookSDK.string)中,因此一旦添加此bundle,共享和喜欢按钮将根据设备语言自动更改区域设置。
 /* The format string for device login instructions */
"DeviceLogin.LogInPrompt" = "Visit %@ on your smartphone or computer and enter the above code.";

/* The title of the label to dismiss the alert when presenting user facing error messages */
"ErrorRecovery.Alert.OK" = "OK";

/* The title of the label to decline attempting error recovery */
"ErrorRecovery.Cancel" = "Cancel";

/* The fallback message to display to recover invalidated tokens */
"ErrorRecovery.Login.Suggestion" = "Please log into this app again to reconnect your Facebook account.";

/* The title of the label to start attempting error recovery */
"ErrorRecovery.OK" = "OK";

/* The fallback message to display to retry transient errors */
"ErrorRecovery.Transient.Suggestion" = "The server is temporarily busy, please try again.";

/* The label for the FBSDKLikeButton when the object is not currently liked. */
"LikeButton.Like" = "Like";

/* The label for the FBSDKLikeButton when the object is currently liked. */
"LikeButton.Liked" = "Liked";

/* The label for the FBSDKLoginButton action sheet to cancel logging out */
"LoginButton.CancelLogout" = "Cancel";

/* The label for the FBSDKLoginButton action sheet to confirm logging out */
"LoginButton.ConfirmLogOut" = "Log Out";

/* The fallback string for the FBSDKLoginButton label when the user name is not available yet */
"LoginButton.LoggedIn" = "Logged in using Facebook";

/* The format string for the FBSDKLoginButton label when the user is logged in */
"LoginButton.LoggedInAs" = "Logged in as %@";

/* The short label for the FBSDKLoginButton when the user is currently logged out */
"LoginButton.LogIn" = "Log in";

/* The long label for the FBSDKLoginButton when the user is currently logged out */
"LoginButton.LogInLong" = "Log in with Facebook";

/* The label for the FBSDKLoginButton when the user is currently logged in */
"LoginButton.LogOut" = "Log out";

/* The user facing error message when the app slider has been disabled and login fails. */
"LoginError.SystemAccount.Disabled" = "Access has not been granted to the Facebook account. Verify device settings.";

/* The user facing error message when the Accounts framework encounters a network error. */
"LoginError.SystemAccount.Network" = "Unable to connect to Facebook. Check your network connection and try again.";

/* The user facing error message when the device Facebook account password is incorrect and login fails. */
"LoginError.SystemAccount.PasswordChange" = "Your Facebook password has changed. To confirm your password, open Settings > Facebook and tap your name.";

/* The user facing error message when the device Facebook account is unavailable and login fails. */
"LoginError.SystemAccount.Unavailable" = "The Facebook account has not been configured on the device.";

/* The user facing error message when the Facebook account signed in to the Accounts framework becomes unconfirmed. */
"LoginError.SystemAccount.UnconfirmedUser" = "Your account is not confirmed. Please log in to www.facebook.com and follow the instructions given.";

/* The user facing error message when the Facebook account signed in to the Accounts framework has been checkpointed. */
"LoginError.SystemAccount.UserCheckpointed" = "You cannot log in to apps at this time. Please log in to www.facebook.com and follow the instructions given.";

/* The message of the FBSDKLoginTooltipView */
"LoginTooltip.Message" = "New! You're in control - choose what info you want to share with apps.";

/* Title of the web dialog that prompts the user to log in to Facebook. */
"LoginWeb.LogInTitle" = "Log In";

/* The label for FBSDKSendButton */
"SendButton.Send" = "Send";

/* The label for FBSDKShareButton */
"ShareButton.Share" = "Share";

参考:Facebook更改日志以获取更多详细信息

Stack Overflow链接有更多信息


1
是的,@balakrishnan Mac,你说得对。更改日志清楚地说明它是可选的,因此我们需要将其添加到项目包中,无论应用程序是否使用国际化本地化,现在它正在按预期工作,非常感谢。 - Manobala

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接