iOS Facebook SDK本地化 [英] iOS Facebook SDK localization
问题描述
我正在尝试更改 FBLoginView
按钮中的文字,但到目前为止我还没有运气。我试图从 FacebookSDK
中阅读 README 并查看互联网。我在项目本地化部分中添加了2种语言,它会为每种语言支持文件创建2个文件,但是我尝试用示例内容 README (更改字符串值)更改字符串,但即使我更改了英文文件我总是得到默认的登录字符串。
然后我尝试添加一些Bundle设置,并在那里更改一些文件,但没有运气。有人可以告诉我如何才能实现变化? facebook 字符串一步一步?谢谢
更新:
这里描述的方法不再适用于最新的Facebook SDK。所以请参考@Erik van der Neut或@Ted给出的答案,并使用 FacebookSDKStrings.bundle ,SDK附带字符串覆盖。
我们发现到目前为止本地化/更改Facebook字符串的唯一方法在他们的常见问题解答中描述: FacebookSDKOverrides.bundle 来自Facebook SDK附带的Scrumptious示例项目。这基本上只是一个包含(可以包含)不同的本地化文件夹的包。如果要添加德语字符串,请在该包中创建一个文件夹 de.lproj
。该文件夹应该包含一个文件 Localizable.strings
。
您可以在文件中找到所有可替换字符串的列表 FacebookSDKResources.bundle.README
。您可以在FacebookSDK文件夹中找到它:
FacebookSDK.framework / Resources /
或这里: https://github.com/facebook/facebook-ios-sdk/blob/master/src/FacebookSDKResources.bundle.README
要添加登录按钮文本的德语翻译,例如,您必须将以下内容添加到de.lproj中的Localizable.strings文件中:
FBLV:LogInButton=Einloggen;
作为最后一步,您必须确保Facebook知道该捆绑包。因此,您可以将以下内容添加到Info.plist中:
< key> FacebookBundleName< / key>
< string> FacebookSDKOverrides< / string>
或者,您也可以在代码中指定此代码:
[FBSettings setResourceBundleName:@FacebookSDKOverrides];
这对我来说很有用,虽然我想使用我的主包来覆盖,只是在我正常的应用程序翻译这对于连接到翻译工具来说会更为方便,因为您不需要翻译每种语言的多个文件。
I am trying to change text in FBLoginView
button but I have no luck so far. I've tried to read README from FacebookSDK
and look at internet. I added 2 languages in project Localizations sections it creates 2 files in Supporting files for each language but I tried to change strings in there with example content of README (with changed string values) but even if I changed english file I always get default login string.
Then I tried to add some Bundle settings and change some files in there but with no luck too. Can someone tell me how can I achieve change facebook strings step by step? Thanks
Update:
The method described here is no longer applicable for the latest Facebook SDKs. So please refer to the answers given by @Erik van der Neut or @Ted, and use the bundle FacebookSDKStrings.bundle that ships with the SDK for string overrides.
The only way I found so far to localize/change the Facebook strings is described in their FAQ: https://developers.facebook.com/docs/ios/troubleshooting/
What I did was to copy the file FacebookSDKOverrides.bundle
from the Scrumptious sample project that ships with the Facebook SDK. This is basically just a package that contains (can contain) different localization folders. If you want to add German strings, create a folder de.lproj
within the bundle. This folder should contain a file Localizable.strings
.
You can find a list of all overrideable strings in the file FacebookSDKResources.bundle.README
. You can find it in the FacebookSDK folder:
FacebookSDK.framework/Resources/
or here: https://github.com/facebook/facebook-ios-sdk/blob/master/src/FacebookSDKResources.bundle.README
To add a German translation of the text of the login button, for example, you have to add the following to the file Localizable.strings in de.lproj:
"FBLV:LogInButton" = "Einloggen";
As a last step, you have to make sure that Facebook knows about the bundle. Therefore, you can add the following to your Info.plist:
<key>FacebookBundleName</key>
<string>FacebookSDKOverrides</string>
Alternatively, you can also specify this in code if you want to:
[FBSettings setResourceBundleName:@"FacebookSDKOverrides"];
This worked for me, although I would like to use my main bundle for overrides and just specify them in my normal app translations. This would come in more handy for the connection to translation tools as you don't need to translate multiple files per language.
这篇关于iOS Facebook SDK本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!