Xamarin.iOS本地化的NSLocationWhenInUseUsageDescription
有没有办法在Xamarin Studio中本地化中的NSLocationWhenInUseUsageDescription
? 或者本地化完整的Info.plist
的任何可能性也是一个解决方案。Xamarin.iOS本地化的NSLocationWhenInUseUsageDescription
我尝试了以下步骤,因为它看起来与 How to localise a string inside the iOS info.plist file?类似,但它对我不起作用。
因此,这些步骤如下:
在这两个en.proj
和de.proj
:
我添加了一个空文件InfoPlist.strings
在Info.plist
:
我已经设置的 “NSLocationWhenInUseUsageDescription
” 的关键在于 “NSLocationWhenInUseUsageDescriptionMessage
”。
在InfoPlist.strings
:
我添加了“NSLocationWhenInUseUsageDescriptionMessage
”作为字符串的文件中的每个相应的转换键,但似乎没有工作 - >当用户要求显示在原始字符串“NSLocationWhenInUseUsageDescriptionMessage
”许可。 。
我有类似的问题(我只用“永远”,而不是“WhenInUse”这是什么工作:
在这两个en.lproj和de.lproj添加文件InfoPlist.strings每个文件都包含只有一行:
"NSLocationAlwaysUsageDescription" = "Your location needed, because...";
在Info.plist中,字符串也无所谓了,因为它将从InfoPlist.string文件中采取的Info.plist相关的代码行是这样的:
<key>NSLocationAlwaysUsageDescription</key>
<string>No text needed here.</string>
也许你忘记了strings-files中的分号?或者你的两个文件夹被命名为* .proj而不是* .lproj?
我们面临着NSLocationWhenInUseUsageDescription
本地化的类似问题。该翻译显示在iOS模拟器上,但从未在真实设备上显示。在Info.plist中将我们的CFBundleLocalizations数组从大写语言代码修复为小写后,所有语言的权限描述都被正确翻译。
不正确:
<key>CFBundleLocalizations</key>
<array>
<string>EN</string>
<string>DE</string>
<string>BG</string>
<string>PL</string>
<string>FR</string>
<string>CS</string>
</array>
正确:
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
<string>bg</string>
<string>pl</string>
<string>fr</string>
<string>cs</string>
</array>
谢谢你的建议。我会尽快尝试iOS8版本的应用程序。目前我停止在iOS8版本上工作,因为那里有很多iOS7设备,这个字符串在iOS7上不需要。 – 2014-11-28 14:04:53
这似乎不适用于我的情况。当用户使用NSLocationWhenInUseUsageDescription消息提示时,会显示Info.plist中的消息(在您的示例中:“此处不需要任何文本”)。我已经添加了这些文件:Resources \ en.lproj \ InfoPlist.strings(在我的情况下为fr.lproj),并将以下内容作为测试:“NSLocationWhenInUseUsageDescription”=“bbbb”; – Frank 2016-11-02 17:53:52