'Why some string in SwiftUI app are not localized

I use Export/Import localization functionality in Xcode 13.2.1 and it works more or less fine but some strings are not exported in xcloc file, for example texts from function below

func createInitialStepTypes(inContext context: NSManagedObjectContext) {
    let names = ["NVA", "NEC", "VA"]
    let nvaDesc = "Step with not added value (typically preparing of equipment, exception handling, etc.)."
    let necDesc = "Necessary steps but still not adding value (typically system actions like login, manual data entry, etc.)."
    let vaDesc = "Step with added value (typically material handling)."
    let descs = [nvaDesc, necDesc, vaDesc]
    let colors: [Color] = [Color.red, Color.orange, Color.green]
    for (i, _) in names.enumerated() {
        name = names[i]
        desc = descs[i]
        color = colors[i]
        save(stepTypeID: nil, inContext: context)
    }
}

Strings from other functions in the same class like e.g. this one

 errMsg = "Step type \(stepType.name!) can't be deleted because it's being used."

are captured correctly. Any idea why? Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source