For example, when I define the string "%lld person" = "^[%lld person](inflect: true)"; in localizable.string, and call it with the R.string.localizable.lldPerson(2), it will return ^[2 person](inflect: true), not the 2 people as I expected.
To leverage the automatic grammar agreement, I need to define the following:
"person" = "person";
"%lld %@" = "^[%lld %@](inflect: true)";
Use the R.swift to get the translation:
let person = R.string.localizable.person()
let attributedString = AttributedString(localized: "\(num) \(person)")
return String(attributedString.characters)
So that it will return "2 people", which is translated and pluralized.
Is there any better way to do that?