Localization: Changing keys in auto-generated Localizable.xcstrings file

Question

I am starting the process to localize my iOS app for the first time. I hadn't planned for this in advance, so my code is littered with SwiftUI code like:

Text("You have no location.")

Using Xcode 26.4, I added an xcstrings file, and then built the project, causing Xcode to automatically extract the localizable strings. But because of the state of my code, the keys Xcode is using to reference the translations match the Strings themselves.

What I'd like to do now is change the keys so that instead of "You have no location.", I use a key like "Location.Missing".

When I right click on a row in Localizable.xcstrings in Xcode, there is a "Change Key" option in the "Refactor" submenu. This changes the key in the xcstrings file and in the code itself, but it *also* changes the default English translation. So I then have to go back in and re-add the English string to make sure it isn't lost.

I feel like in my first-time ignorance I must be doing something wrong. All the guides online show the best practice of using generic keys like "Location.Missing". What is the best way to define these keys if they weren't defined up-front before Xcode extracted the strings?

https://preview.redd.it/nez05h85bnrg1.png?width=424&format=png&auto=webp&s=d0aa7ffdf8bec87fd840bfb3bd3e31598204b0ba

https://preview.redd.it/a2hmqmo5bnrg1.png?width=468&format=png&auto=webp&s=3b64b2cb3cd5e3afc600b7fd02519953b01bda3f

https://preview.redd.it/dulkdux5bnrg1.png?width=560&format=png&auto=webp&s=cb226d3b2786bea4741d39355db8a9be87b54b2d

https://preview.redd.it/obuk1dh6bnrg1.png?width=568&format=png&auto=webp&s=19e1d02da24db16f5f7901ba1dadc0ac70c4d795

Posted Mar 27, 2026, 8:14 PM UTC

26
Loading comments…