Xamarin.iOS本地化NSLocationWhenInUseUsageDescription [英] Xamarin.iOS localization of NSLocationWhenInUseUsageDescription

查看:175
本文介绍了Xamarin.iOS本地化NSLocationWhenInUseUsageDescription的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Xamarin Studio中本地化 Info.plist 中的 NSLocationWhenInUseUsageDescription
或者任何可以本地化完整的 Info.plist 的解决方案都可以。

尝试以下步骤,因为它看起来类似于
如何在iOS info.plist文件中本地化一个字符串?,但它不适用于我。



所以这些是步骤: />
en.proj de.proj

我添加了一个空文件 InfoPlist.strings



Info.plist
我已经将 NSLocationWhenInUseUsageDescription 的键设置为 NSLocationWhenInUseUsageDescriptionMessage



InfoPlist.strings

我添加了 NSLocationWhenInUseUsageDescriptionMessage 作为字符串文件中的键和每个字符串文件中的相应转换,但似乎不起作用 - >原始字符串 NSLocationWhenInUseUsageDescriptionMessage 会在用户被要求获得权限时显示。

解决方案

I有类似的问题(只有我用总是而不是WhenInsese)。这是什么工作:



在en.lproj和de.lproj中添加文件InfoPlist.strings。每个文件只包含一行:

 NSLocationAlwaysUsageDescription=您的位置需要,因为...; 

在Info.plist中,字符串无关紧要,因为它将从InfoPlist .string文件。 Info.plist中的相关行如下所示:

 < key> NSLocationAlwaysUsageDescription< / key> 
< string>此处不需要文字。< / string>

也许你忘记了strings-files中的分号?或者你的两个文件夹被命名为* .proj而不是* .lproj?


Is there a way to localise the NSLocationWhenInUseUsageDescription in Info.plist in the Xamarin Studio? Or any possibility to localise the complete Info.plist would be a solution as well.

I tried the following steps as it looks analogue to the How to localise a string inside the iOS info.plist file? but it does not work for me.

So these are the steps:
In both en.proj and de.proj:
I added an empty file InfoPlist.strings

In Info.plist:
I have set the key of the "NSLocationWhenInUseUsageDescription" to "NSLocationWhenInUseUsageDescriptionMessage".

In InfoPlist.strings:
I added the "NSLocationWhenInUseUsageDescriptionMessage" as key in the strings files and the corresponding transitions in each, but it seems not to work -> the raw string "NSLocationWhenInUseUsageDescriptionMessage" is shown when the user is asked for the permission.

解决方案

I had similar problem (only I used "Always" instead of "WhenInUse". Here's what worked:

In both en.lproj and de.lproj add the file InfoPlist.strings. Each of the files contains only one line:

"NSLocationAlwaysUsageDescription" = "Your location needed, because...";

In Info.plist, the string doesn't matter anymore, because it will be taken from the InfoPlist.string file. The relevant lines in Info.plist look like this:

<key>NSLocationAlwaysUsageDescription</key>
<string>No text needed here.</string>

Maybe you forgot the semicolon in the strings-files? Or your two folders were named *.proj instead of *.lproj?

这篇关于Xamarin.iOS本地化NSLocationWhenInUseUsageDescription的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆