My application is localized in two languages. I have pairs of xib files for the two localizations. When I change the device/simulator language, or when I modify xib files and rebuild-run the application, the old xib files are still used in the application, seem to be cached somewhere. How to tell my app to delete cached xib files?
Edit:
Check this scene:
On device, I run the app while the device language is English, all xib files are English. Then I change device language to Arabic, restart the device, Xib files still english!
what is the problem? and how to solve it?
From Xcode:
Build Menu -> Clean
and/or
Delete app from simulator
(usually I do both)
Make sure the xib are only in the localized directories
Related
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 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.
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.
I want to localize my iOS project in xcode4. In xcode4 this seems to be very simple. In the utility sidebar there is a localization panel where I can add languages.
Adding a language I get following structure:
I want to localize a button. So I open MainWindow.xib (German) and just edit the title of the button. But when I run my project on both device or simulator I always get the english version even if it is set to German.
Where is the problem? Any ideas?
Delete the app from the device or simulator. If you've launched it before you've added the localization there is still a MainWindow.xib in the root file structure of the project.
If you deploy from Xcode files are only added, never removed.
So you have three files now.
MainWindow.xib
de.lproj/MainWindow.xib
en.lproj/MainWindow.xib
And as long there is a file in the root folder iOS doesn't look into the language specific folders.
Go into settings on the iPhone or Simulator and change the International from English to German, then restart the app.
I have an iPhone xib I want to turn into an iPad xib. In Xcode 3 there was a "Create iPad Version" menu option. How do I do this in Xcode 4?
I currently resized my xib, but when I turn on the simulated items (Navigation Bar, etc.) it shrinks the view back down to iPhone size.
This worked for me:
Make a copy of the .xib in the Finder.
Open the copied file in a text editor.
Change "com.apple.InterfaceBuilder3.CocoaTouch.XIB" to "com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB".
Change all instances of "IBCocoaTouchFramework" to "IBIPadFramework".
Search for sizes like {480, 320} and edit them. Or just reopen the file in Xcode and use the GUI to resize items as needed.
This also works in reverse, if you need to change an iPad xib into an iPhone xib.
in Xcode 4 it's quite hidden, but the option to convert XIBS in the app still exists.
Select the target (in XCODE4 it's shown when you select the project). Once selected use the contextual menu to "Duplicate" it. It will ask if you want to "Duplicate and transition to iPad". Then all the XIBS will be duplicated with the new iPad size.
On assessing my options, these were my thoughts:
Too much of a hassle to install xcode 3 and downgrade project
Don't want to mess with .xib file format - afraid it might break something that will show itself much later
Copying the same nib is imperfect (see the explanations in this thread)
So finally, what I ended up doing that works fine is:
Create a new file, choose "UIViewController derived" class
Check the "intended for iPad" checkbox
Name the file -iPad
Delete the .h and .m corresponding to the uiviewcontroller
Now populate the new nib with the same objects, structure and connections as the original nib
Check if on iPad, if so then load the new nib else load the old nib
The feature has been removed from Xcode 4.
Right now the easiest way is to use Xcode 3 for the conversion, since the nib (.xib) file format did not change.
Xcode 3 & 4 can now be both installed on the same system by simply selecting a different folder (see installation instructions on the disk image).
Another simple way in XCode4 is: Just copy the iPhone XIB in Finder; drag the copy in your project. Open the copied XIB in XCodes build in interface builder. Change the size of the top view in your NIBs hirarchy to iPads dimensions (e.g. 1024x748 for landscape with statusbar) - everything else resizes according to the autoresizing masks.
Works perfect for me.
If you make a new nib, it will ask you if it should be sized for iPad. That might be the easiest unless you've already done a bunch of work on it.
You will have to use the older version of Interface Builder to use the "Create iPad version using autoresizing masks". There currently is no option in Xcode 4 that will do this.
Using XCode 4, all you have to do is select the (iPhone-specific) .xib file in the project navigator, then select File... --> Duplicate...
Name the new .xib file the same as your iphone-specific one, but append ~ipad to the name. All your previous connections in the view hierarchy should be unchanged in your brand-new iPad-specific .xib file.
You can use this tool I made, based on the answer from "arlomedia":
http://iphone.dizzystudios.net/ConvertToiPad
just give it the iPhone xib path