I tried to migrate to the new localized string catalogs. But after this I can't build the app anymore. The error message stated something about an "old" .string file... but I checked all directories and there are no old .string files...
Anybody a hint how to go further?
And this is how the directories look after migration ...
Your first screenshot shows the following errors:
Localizable.xcstrings cannot co-exist with other strings or .stringsdict tables with the same name.
LocalizableDic.xcstrings cannot co-exist with other strings or stringsdict tables with the same name.
InfoPlist.xcstrings cannot co-exist with other strings or stringsdict tables with the same name.
These errors are typically triggered because the .strings
or .stringsdict
files exist in the Base.lproj
folder in your project.
Base.lproj
is for something like a storyboard, which you have a base resource in Base.lproj
and each locale (including English) has a .lproj
folder with a .strings
file that overlays the translations on top of the same base resource. It should not contain any .strings
or .stringsdict
files.
Xcode doesn't provide a good way to remove the files from Base.lproj
, and so I'd consider fixing the issue with the following steps:
-
Back up your project.
-
Remove the
.strings
or.stringsdict
files from your project. In this case, they areLocalizable.strings
,Localizable.stringsdict
, andInfoPlist.strings
, as mentioned in the error message. Note that you need to trash the files, and not just remove the reference from your project. -
Add the files back from your backup project. To do so, place your project and backup project side by side, and then drag and drop the files.
-
Localize the files for the languages you support. To localize a file, select it in Xcode's Project Navigator, click the Localize button in Xcode's File Inspector, then pick the languages. In this process, Xcode creates a
.lproj
folder for each language (if not yet), and copy the file to the folder. Replace the file in each.lproj
folder with the localized version from your backup. As a result, your project has the localized files in each.lproj
folder, but not inBase.lproj
.
Now that your project is correctly configured, right-click a .strings
or .stringsdict
file in Xcode's Project Navigator to show the contextual menu, then select Migrate to String Catalog… menu. Xcode should do the migration for you.