I’m trying to load up a localized html into an UIWebView. All resources I find on google are for the old XCode versions, using en.proj XX.proj Folders in the main Folder.
For localizing my about.htm I go to the “Identity and Type”>”Localization” window and add the localisations to about.htm. On the file system this creates the XX.proj Folders, but in XCode 4 it shows as
> about.htm
about.htm (English)
about.htm (German)
I senn fill the about.htm (German) wiff se German html.
I use one AboutViewController.xib, with one UIWebView and load up as follows:
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString* html = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"about" ofType:@"htm"]
encoding:NSUTF8StringEncoding
error:nil];
[aboutUIWebView loadHTMLString:html baseURL:baseURL];
/*
// this one doesn't show the css images
NSString *indexPath = [[NSBundle mainBundle] pathForResource:@"about"
ofType:@"htm"
inDirectory:nil];
[aboutUIWebView loadRequest:[NSURLRequest
requestWithURL:[NSURL fileURLWithPath:indexPath]]];
*/
This correctly shows the English, but never the German. Even though the rest of the app shows in German, the UIWebView refuses to show the German. A “Reset Content and Settings..” and clean run on the simulator does not help either.
What am I missing? What can be done?
Thank you
Try manually inspecting the folder Xcode creates (in
/Users/<username>/Library/Application support/iPhone Simulator/5.0/Applications/<ID>/<applicationName>.app/). Make sure that the directory structure is as you expected and fix it if it’s not.