I am having multiple issues trying to localize an app with xcode 4.0.2.
This app was coded initially with previous version, but since I installed the 4.0.2 everything (more or less) has worked, except localization. I have about 10 png's that load in 10 different xibs via UIImageView using Interface Builder. These png's are "correctly" localized, inside the es.lproj folder the spanish ones and in the en.lproj folder the english ones.
The weird thing is that even inside xcode, when I open the xib file, it sometimes shows the english version and sometimes the spanish. ¿?
The xibs are not localized, because there is nothing more to localize in there, just that UIImageView with the png's.
Is it not possible to localize just the png's?
Does anyone know if this issues respond to known bugs?
This png's are named text1.png, text2.png, text3.png ... Could it be something related to the serialized naming?
The default xib when there's no localization is english. When it load it pulls in the english resources. So you need to create the localized xibs in addition to the images. Or, what I'd recommend in your case since it's just 10 images, is to load and set the correct image in viewDidLoad. It'll be easier to maintain since you won't have to update every localized version of the xib for every change you make. Save that headache for when you have more items in one that are localized. :)
Well, I think that I get it...
I have changed the name to the png's. Instead of text1.png -> textone.png, texttwo.png ...
(The name should not be a problem, though)
When changing the names, some of the png's has become red. Even though they were still in the right lang.lproj (ex. en.lproj) folder.
I have created another directory to back-up the files and cut-paste all the "red ones".
Then I have deleted (references and file) these files from xcode.
Using finder, I have pasted each one of these png's inside my main language file. Just to move it again to the xcode resources from there.
After having it in xcode again, I have localized it using the "Localization +" Inspector.
Then, using finder again, I have replaced new "localized" png inside lang.lproj (ex. es.lproj) with the old language png in the back-up folder.
Finally, I have deleted the app in the simulator, cleaned, and Run again.
I did the same process with xib files. And everything works now. I haven't found any way to fix dependencies or paths to files that aparently are ok, but the localization doesn't reach them as expected. I understand that this should not be the way, though.
Related
For some reason, XCode is acting up really oddly. I have been testing XCode's ability to load images with the -hd suffix, and realized that Xcode will load a file "welcomeBackground.jpg" regardless of whether it is actually in my project folder.
See, this code below will not crash when compiled. And this is the first screen that is displayed when the app loads. I deleted the file "welcomeBackground.jpg" from my project folder, and XCode still loads the file as if it were there.
This is really freaking me out. Please help?
I am 200% sure I deleted the file from my project folder even and yet Xcode does not crash on line 35.
EDIT: To repeat, things I have tried/checked
- Cleaned project
- Deleted Derived Data
- Checked for hidden files in project folder
- Deleted app from iPhone and re-run from XCode
- Deleted the files from my project folder
- Loaded another image "sadhieia.png" and crashed Xcode
because Xcode couldn't find the file (as it does not
exist), and then tried "welcomeBackground.jpg" again
and Xcode somehow finds it.
And yet, the background still loads...
In Cocos2d, if the specified image is not in your folder, it'll not crash. Instead, it'll return nil to your CCSPrite *background.I suggest you Don't use Camelcase for images. Use lowercases or underscores. Try deleting Derived Data. See this for how to delete derived data.
Scroll the project navigator down to the bottom, to "Products," then click the disclosure arrow to show your application.
Right-click the application and choose "Show in Finder" from the contextual menu that appears. A Finder window is displayed containing your application.
Command-click the title of that window; another contextual menu appears. From that, choose the folder "Derived Data." The Finder then displays a window for that folder.
In this window, you'll see a folder whose name is that of your application, followed by a long string of letters. Trash it. If you see multiple folders bearing your application's name, trash them as well.
Rebuild your project. That should take care of the issue.
This might be a slash and burn approach, but it's solved a lot of quirky project-related issues I've experienced in Xcode after attempting to clean.
Clean your project; your image file is still cached in the build folder.
My app is currently localized for English and Japanese, with seperate storyboards for each. I want to switch to base localization so that I only have to maintain a single storyboard. I've checked the "Use Base Internationalization" box in the project's info tab and chosen the English iPhone and iPad storyboards for the base.
I assume I should delete the Japanese iPhone and iPad storyboards I had previously used, but I don't see an option to delete them when right-clicking on their files in the file inspector. Should I delete these old storyboards, and, if so, how?
** Edit **
Changing the 'Main Interface' shown in the screenshot doesn't allow me to delete the Japanese storyboard. It's hard to tell which storyboard to select in the dropdown because its width is more narrow than the storyboard names, but that's a separate issue.
This tutorial drives you through the process step-by-step. This is how it worked for me:
Remove all localizations and leave only the base.
Ensure that the localized files were moved from the project directory (in Finder)
Add the localizations one-by-one
The localized strings are extracted from the storyboard only when the localization is created. The Tutorial above provides a script that can help you keeping the localized files up to date if the storyboard is changed.
In your case, you will have to merge the existing translations into the new files but I suppose it is not a huge deal compared to the gain with using a single file.
For reference, the process is described in this official tutorial too: http://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html
After cleaning and reloading, I was able to remove the Japanese storyboards by clicking on the - in the project settings:
I have a localized storyboard file the old way (no use of "Base Internationalization"):
I changed the first file by adding a new ViewController. Now I realized, that these changes don't effect the other (localized) storyboard files.
How can I edit all the storyboard files at once?
You don't. You have to change each file individually. That's why Apple created "Base Internationalization."
I used to deal with an OS X app with 23 translations and many nib files. Here's how the process looked prior to Base Internationalization:
Work only in one language
At some point close to release, localize
Hope desperately that you will not need to touch localized resources until release
Release
Blow away your localized resource files and begin another round
It's not pretty. Again, that's why we have Base Internationalization. Now may be a good time to move over.
I created bunch of localized xib files -- Chinese, Japanese, etc. But when I switch my iphone language, the localized xibs are not being used and the labels remain Eng. However the strings are being picked up correctly.
Anybody have any ideas where I should troubleshoot?
The answer for me was to do a Clean build on the project, then delete the app on the device, then rebuild/reinstall. Just doing a Clean build wasn't enough, but deleting the app and reinstalling did the trick.
Some recent version of iOS caused my app icon to turn white. I've gone through everything in regards to images and can't find the issue. I'm running Xcode 3.2.5 with sdk 4.2. I do have an entry for "Icon files" in Info.plist with 5 keys:
Item 0 myapp.png
Item 1 myapp#2x.png
Item 2 myapp-72.png
Item 3 myapp-Small-50.png
Item 4 myapp-Small.png
Item 5 myapp-Small#2x.png
All the above have proper dimensions.
I see the image in 'Copy Bundle Resources' and also in the .app file for the simulator version. It is properly reference by name in 'Icon files', Item 0. It is not named Default.png since it is referenced by name in Item 0.
Any suggestions?
You just need those 3 Files:
Icon.png
Icon#2x.png
Icon-iPad.png
Put the names into the Info.plist under Icon Files.
EDIT: Clean your target if it still won't work!
That is what helped me (project summary - app icons are ok, iOS simulator - app icons are ok, iPhone device - blank icon).
Just reconnect your icons to project by dragging them from project navigator to App icon section in project summary.
When does it turn white? If you upgrade an app when it's running, sometimes it appears with a white icon in the "task" bar. This applies to apps you're developing and those download from iTunes. The fix is usually just to kill the app and restart.
That's the simplest answer, but I suspect might not be the solution.
Does the case of the file names in your Info.plist match the actual file names? The Simulator is not case sensitive but the iOS is.
You might also like to make a completely clean build. Don't just do a "Clean" in Xcode, instead manually clear out your build folder.
Finally, when the iPhone 4 first came out I had some issues with the order of the icons referenced in the Info.plist. I never saw white icons (usually just the non-Retina version) but this may be something worth playing with if nothing else works.
The icon file name may be too long if it is a custom file name. This is just a guess, and I hate guessing, but this appears to have been the problem I just had.
I have four targets using the same code but with different icons. I named the icons differently based on the app name, so I could store them in the same directory.
For example:
Icon.png
Icon_second.png
Icon_alternate.png
Icon_second_alternate.png (or Icon_secondalternate.png in case underscores were an issue)
This nomenclature was used for all of the icon names (there's 8 icon files to support iPhone, iPad, retina, etc).
The last one was giving me a problem. Despite a hundred clean/rebuilds, deleting the schema entirely and creating a new one, fruitless efforts, it suddenly occurred to me to try renaming it.
You should be able to name the icons differently, as I still use the first three versions. They are listed in the plist file and render in the project summary, and on the simulator, just fine. The last one rendered in the summary as well. However, I think the length of the file name was too long for the simulator. There must be a length limit. I renamed the fourth one to use the standard Icon.png naming but added it to the fourth target only (images are stored in a separate folder).
CONCLUSION: If you have more than one target for your app, use the standard naming system for all of your icons but add them to separate folders, and then when adding to Xcode just set the build target appropriately.
If you still have the default icon entry (even blank), this can happen, remove that entry in info.plist.
Also, Default.png would be your splash screen.
Load the icons into the Preview application, and make sure they are really png format (and not just named such) by doing a "Save As..." specifying PNG format in the save dialog. Do a Get Info to check the sizes. Make sure the case of all letters in the name match your plist entries.
I had the same problem recently - the Icons I was using were created in GIMP. When I opened them in Photoshop on the development Mac it complained about an ICC color profile. After re-saving the PNGs in Photoshop the Icons worked like a treat.
P.s. I just repeated my steps in creating the images in GIMP, but when saving unticked every extra option that GIMP - by default - was trying to add into the image when saving it. The icons worked perfectly this time around.
If you believe your icon configuration is correct, then you may simply be seeing a bug in Xcode.
As a workaround…
"Clean" your project. Choose Xcode > Product > Clean.
Delete the app from your simulator, or even reset the Simulator by choosing iOS Simulator > Reset Content and Settings.
Quit both the iOS Simulator and XCode apps, then restart them.