Label cannot export localized string key

Hello all. This is my code snippet.

RecordListView()
                .tabItem {
                    Label("Record List", systemImage: "list.clipboard")
                }
                .tag(Tab.RecordList)

When I export localizations, there is no Record List in the .xcloc file.

Then I use LocalizedStringKey for Label and export localizations file, the code is as follows:

let RecordsString:LocalizedStringKey = "Tab.Records"
RecordListView()
                .tabItem {
                    Label(RecordsString, systemImage: "list.clipboard")
                }
                .tag(Tab.RecordList)

There is still no Tab.Records.

Answered by Developer Tools Engineer in 814577022

Hello, Please double-check the build setting: Use Compiler to Extract Swift Strings

Accepted Answer

Hello, Please double-check the build setting: Use Compiler to Extract Swift Strings

There is some compiling errors in my project. I'm export strings success after fixed those errors.

If you export localization strings failed too, and set use Compiler to Extract Swift Strings is Yes. You need to check compiling error info in the Report Navigator and fixed those error.

Label cannot export localized string key
 
 
Q