5

Im trying to localize the Summary of my new SwiftUI AppIntent on my Swift project for making new Shortcuts.

I am not able to localize the Summary. I have created a AppShortcuts.strings with Localize of English and Spanish languages like in this page appears: click here.

AppShortcuts.string (es):

"add ${numberOne} ${numberTwo}" = "Sumar: ${numberOne} ${numberTwo}";

Shortcut:

static var parameterSummary: some ParameterSummary {
        Summary("add \(\.$numberOne) \(\.$numberTwo)") {
            \.$numberThree
            \.$numberFour
        }
    }
Adri
  • 51
  • 1

2 Answers2

0

As stated in the article you have already mentioned these directives have to go into Localizable.strings:

ParameterSummary – This one is tricky. You'd think that because it has a variable it should be with the translations of the phrases in AppShortcuts.strings, but no, it belongs in Localizable.strings.

Don't know why but that works for me.

FPP
  • 278
  • 3
  • 7
0

Create your translation in Localizable.strings this way:

"Do something with ${text}" = "Do something with ${text}";

You have to put the exact name of the parameter you are interpolating, if you do interpolate.

static var parameterSummary: some ParameterSummary {
    Summary("Do something \(\.$text)")
}

@Parameter(title: "To do")
var text: String
zouritre
  • 231
  • 3
  • 6