I want to migrate my project in the long-term to use the brand-new String Catalogs in Xcode. However, I still have a Localizable.strings file in my project and I don't want to migrate the entire file at this moment. So I intend to use both in parallel for some time.
In the related WWDC video, Apple says that
String Catalogs can coexist with the legacy formats.
However, when I add a String Catalog to my project and give it the default name Localizable.xcstrings, Xcode throws a compile error:
Localizable.xcstrings cannot co-exist with other .strings or .stringsdict tables with the same name.
which is kind of contradictory.
Anyway, when I renamed the String Catalog file (e.g. to WidgetLocalizable.xcstrings), the project build successfully. However, Xcode does not automatically create the entries in the String Catalog for me as I no longer use the default name.
I could add all those keys manually, but this has 3 downsides:
- It's more work.
- It's less safe as Xcode can no longer track the progress of my translation (as it doesn't know of the string literals used in the project).
- I have to append the
tablename every time I create aLocalizedStringResourcein code.
Is there a way out of this?
- Can I use a custom file name for a String Catalog and still have Xcode automatically create the keys for me? How?
- Is there any way to tell entire files or folders in Xcode to use a specific non-standard String Catalog file, so I don't need to append it to every single string I create in code?