How to add Superscript string in Localization file in iOS

441 Views Asked by At

I have localizable English and French. I want display Registered symbols as a part of word i.e "MyApp®". English part of localization file shows this symbol correct in iOS APP UI. Same needs to display for French version i.e "MyAppᴹᴰ" but space comes in between 'M' and 'D'.

I also tried using unicode like MyApp\u{1D39}\u{1D30}. This gets worked in Swift playground but if I try it through Localization file it doesn't work.

iOS version: 11.4 I need to make changes in localization file only and not to use NSAttributed string every where in code. If anyone came across same problem, and found solution please post.

"MyApp®" = "MyApp\u{1D39}\u{1D30}" // Localization file

print(String(describing: "MyApp\u{1D39}\u{1D30}" // swift playground
print(String(describing: "ᴹᴰ")) // swift playground

"MyApp®" = "MyApp\u{1D39}\u{1D30}" // Localization file
"MyApp®" = "MyAppᴹᴰ" // Localization file- on UI space comes b/w ᴹ and ᴰ

print(String(describing: "MyApp\u{1D39}\u{1D30}")) // swift playground
print(String(describing: "ᴹᴰ")) // swift playground

"MyApp®" = "MyApp\u{1D39}\u{1D30}" // Localization file

On iOS app UI component should render MyApp® as MyAppᴹᴰ and no space between ᴹ and ᴰ.

1

There are 1 best solutions below

2
rmaddy On

Instead of using the separate superscript and characters, why not use the actual (U+1F16B) character?

In your localization file, put:

"MyApp®" = "MyApp"