'Xcode Import For Localizations Missing Resource in Import error
After having our app translated in a few languages, we realized that there were a couple .strings
files that had been included in the .xliff
files that were not needed to be translated, so they could be deleted.
So, I unchecked the localization option for those languages in Xcode and deleted the .string files.
However, now whenever I import a .xliff file it still somehow things in it missing localization for those files we don't want anymore.
Importing will crash Xcode.
Even doing an Export for Localizations will reference those .strings files that are nowhere anymore.
Where in our Xcode project could those files be still referenced? I can't import localizations until I get this fixed.
Solution 1:[1]
I've got the same issue, for me it was caused by incorrect paths in xliff itself.
Check the original attribute in files
<file original="..." source-language="en" target-language="cs">
for me it has the path that included the root directory (e.g. "ProjectDir/Resources/..." instead of "Resources/..."). This blocked import.
In your case
I assume you'll have to go through xliff files and find that reference strings that you deleted and remove such blocks (<file original="path/to/deleted.strings">...</file>
)
In general
I've written a simple bash script that expects all affected files as arguments and modifies the original attribute in case contains invalid path:
for file in "$@"
do
sed -i '' -E "s#original=\"**ProjectDir**/#original=\"#g" "$file"
done
Replace ProjectDir with whatever your root folder is (or any extra parent folders) and it will be trimmed.
Note that it will edit passed files, so make sure you have a backup.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |