Xamarin.iOS本地化NSLocationWhenInUseUsageDescription
有没有一种方法来本地化NSLocationWhenInUseUsageDescription
在Xamarin Studio Info.plist
中? 或者任何将Info.plist
本地化的可能性也是一个解决scheme。
我尝试了以下步骤,因为它看起来类似于如何本地化iOS info.plist文件中的string? 但它不适合我。
所以这些是步骤:
在en.proj
和de.proj
:
我添加了一个空文件InfoPlist.strings
在Info.plist
:
我将“ NSLocationWhenInUseUsageDescription
”的关键字设置为“ NSLocationWhenInUseUsageDescriptionMessage
”。
在InfoPlist.strings
:
我在每个string文件中join了“ NSLocationWhenInUseUsageDescriptionMessage
”作为关键字,并在其中对应的转换,但似乎不工作 – >当用户被请求权限时显示原始string“ NSLocationWhenInUseUsageDescriptionMessage
”。
我有类似的问题(只有我用“总是”而不是“WhenInsese”。这是什么工作:
在en.lproj和de.lproj中添加文件InfoPlist.strings。 每个文件只包含一行:
"NSLocationAlwaysUsageDescription" = "Your location needed, because...";
在Info.plist中,string无关紧要,因为它将从InfoPlist.string文件中获取。 Info.plist中的相关行如下所示:
<key>NSLocationAlwaysUsageDescription</key> <string>No text needed here.</string>
也许你忘了string文件中的分号? 或者你的两个文件夹被命名为* .proj而不是* .lproj?
在使用NSLocationWhenInUseUsageDescription
我们遇到了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>