问题
We localized a project recently into to 15 languages using Xcode but I noticed when I took the project home the paths to some of the localized files were all hardcoded to the full path of my work mac.
We only localized two files:
InfoPlist.strings
Localizable.strings
We used Xcode to do the localisation as follows.
We added the 15 languages to the whole project.
Then clicked on Localizable.string and in
File Inspector > Localisation > +
clicking + we added it to the 15 languages we set up for the whole project.
Localizable.strings then moved into
en.lproj/Localizable.strings
fr.lproj/Localizable.strings
etc.
We sent en.lproj/Localizable.strings to the translators and as each returned we replaced the file in each translation folder.
This was done through Finder not dragging files into XCode (I think, it was a while ago)
To meet deadline I took the project home but when I opened it all the localized files except English were showing red in XCode as if the file was missing.
In finder they were there but I checked File Inspector/Full Path and it was hardcoded to the path of my work mac.
Also the LOCATION drop down was set to ABSOLUTE PATH for the missing files
but is DISABLED so cant change it to RELATIVE TO GROUP.
I noticed the path included a folder with a space so thought maybe this might be the problem though then EVERY file in the project should have problems.
Only way to fix it was tob back up using Finder/Duplicate on each .strings file using Finder.
Then click on Localizable.strings in Xcode (top level/ not individual localization)
Then in File Inspector delete the missing Localizations and re-add it.
This will ask you to replace the existing file (it copies the en.lproj version over it, thats why you need to back up with Duplicate)
so after you need to go back into Finder and put the Duplicate back.
any idea why it happens? or how to change it easily (Location drop down is disabled). Any idea why the drop down to set a file RELATIVE TO THE GROUP is disabled.(I presume its because XCode manages the Localisation)
cheers
来源:https://stackoverflow.com/questions/10138338/localized-file-paths-hard-coded-in-xcode-4-disappear-when-project-moved-to-new