簡體   English   中英

無法在Info.plist中使用Localizable.strings

[英]Can't use Localizable.strings inside Info.plist

在iOS應用中,我需要在Info.plist文件中包括以下內容:

<key>NSMicrophoneUsageDescription</key>
<string>"This app needs microphone access for voice recording."</string>

所有功能都與功能有關。 用戶可以在授權后訪問麥克風。

這是讓我擔心的事情:

我想本地化字符串。 由於某種原因,我無法使其正常工作。

我嘗試了各種方法來放入類似內容:

"MICUSE" = "This app needs microphone access for voice recording.";

在一個InfoPlist.strings文件中,然后:

"MICUSE" = "This app needs microphone access for voice recording.(auf Deutsch)";

在另一個InfoPlist.strings

然后將我的Info.plist文件更改為:

<key>NSMicrophoneUsageDescription</key>
<string>${MICUSE}</string>

要么:

<key>NSMicrophoneUsageDescription</key>
<string>$(MICUSE)</string>

另外,請注意將文件包含在正確的目標中。 但是什么都行不通。

我在這里想念什么?

您應該使用InfoPlist.strings文件來本地化Info.plist的值。 為此,轉到File-> New-> File,在iOS的Resource選項卡下選擇Strings File,將其命名為InfoPlist,然后創建。 打開並插入要本地化的Info.plist值,例如:

“ NSLocationWhenInUseUsageDescription” =“對此的描述”; 現在,您可以使用翻譯本地化InfoPlist.strings文件。 祝好運!

編輯:

選擇本地化選項,或根據需要啟用本地化,

右側編輯

您應該也可以在左側編輯器中看到該文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM