Hi,
I‘m excited for the new localization features in Xcode 13. I learned something new about how it is expected to use Localization Strings.
Before watching the videos I‘d always use a unique key for localizations, such as "navigationbar_leadingButtons_back" = "Back" and used them in my code, which made it a bit tricky to read them, instead of how it is shown in this WWDC by just using the english text "Back" and use "Back" as a key.
However, if I have a longer sentence, let‘s suppose a description of a feature that has several lines.
"This feature provides the ability to do xyz"
If this is used as a Localization Key, then changing the text (because of changes of the feature or another reason) creates a new key, which breaks most of the translations that have already been done, since the key is gone right? If I export Localizations again now, then already translated strings for the old key are dropped, aren‘t they?
I wonder why it is not advised to use developer friendly keys, that don‘t change and only change the text if needed?
Additionally neither strings, nor developer-friendly strings as keys support compile time existence checks as far as I understand. Of course there are fallbacks to other languages, but it doesn‘t tell you unless you try out the app in that language. That‘s why I‘m still using developer-friendly keys with underscores in order to generate Swift Code from them to be used in my app, which gives some compile time check opportunities, as you can‘t access the localization if there is no key for it.
How would the problem of renaming a key, by changing text in your app be handled in Xcode‘s Localization generator? And what are good reasons besides legibility for developers only for using complete texts as keys?
E.g Compare:
"This purchase gives you (fuelCount) fuel for your car"
to
Localization.Store.Products.Fuel.purchaseText.text(with: "\(fuelCount)")
And this code represents "store_products_fuel_purchaseText" = "This purchase gives you {0} fuel for your car";
The key would never need to change, if we want to change the text as it is not the same key.
Thanks for any info in advance 😃