How to input a line feed in Property List

Viewed 16

I want to do some localization work by .stringsdict to handle plural issues. I write a sample code to show my question.

In my code:

struct ContentView: View {
    var num = 1
    var body: some View {
        Text("Hello, \nworld!\(num)")
            .padding()
    }
}

The "\n" above represents a line feed.

Then, I create a Localizable.stringsdict. And I define a plural rule in the property list:screenshot

When I run the simulation, the output is

Hello, world!1

It seems not to match the key in code with the key in Localizable. If I delete the "\n" in both places, the output is:

one

This is what I want.

It is obvious that "\n" is not interpreted as carriage return and line feed in property list.

So, how to input a line feed in property list? Any help will be appreciated.

0 Answers
Related