UIWebview Localization - iphone

On a localized Iphone (Language set to Hebrew) when we view a webpage using safari and tap on an input field we get the keyboard up with the "Next/Previous/Done" buttons in Hebrew.
When we view the same webpage using a UIWebview embedded inside our application the "Next/Previous/Done" buttons are always in English.
We were thinking that we might need to add a translation file for those fields but we do not know the keys to use.
Any pointers on this?
Edit: Started a bounty to hopefully get some pointers.
Edit: Attaching two pictures

In your info.plist you can set a value called CFBundleAllowMixedLocalizations, if you check that everything should be translated to the right localized language.

You seem to be knowledgable, but have you tried creating the UIWebView in Interface Builder, then create a localization on the .xib file?
It seems the right way to go, since the keyboard pops up without app intervention; Cocoa Touch is the one to handle that. I think those extra buttons are not part of the keyboard per se, but added by the WebView.

Related

Flip from one ViewController to another iBooks Style

I'm trying to load in content from a database and allow the user to flip through it like pages, then at the end of the content, give them options to go to another section of content (probably with buttons). The content is currently just formatted with html, but how do I implement the buttons to navigate? I'm a little new to Xcode so maybe I'm not even looking in the right direction.
refer a this opensource: https://github.com/devindoty/iBooks-Flip-Animation
this is very little code and perfectly works.

iPhone keyboard in UIWebView, how to change the language of next/previous and done buttons

UIWebView's keyboard is pretty cool with its next/previous and done buttons. However, I was not able to find and change the button titles. The titles are always in english no matter in which language the system is running.
I have been looking for the answer to this for a while for my PhoneGap based application, and at last I found the answer here: UIWebview Localization.
The clue is to set 'CFBundleAllowMixedLocalizations' to 'Yes' in your info.plist. That really made my day :)
Unless you have your own keyboard designed by you which overrides stock one, you can't do that.
Stock keyboard's language is taken from iOS language setting (via Preferences > General > International).
You can set your own view on top of the keyboard. It is really easy after 3.2 and I have some sample code in this answer. That means you can use your own buttons and even set localized text there.
EDIT: That was a bad answer :) Sorry, I didn't see the 'mobile-safari' tag. But in my case, I also get localized versions of the keyboard previous/next buttons.

UITableViewCell with selectable/copyable text that also detects URLs on the iPhone

I have a problem. Part of my app requires text to be shown in a table. The text needs to be selectable/copyable (but not editable) and any URLs within the text need to be highlighted and and when tapped allow me to take that URL and open my embedded browser.
I have seen a couple of solutions that solve one of either of these problems, but not both.
Solution 1: Icon Factory's IFTweetLabel
The first solution I tried was to use the IFTweetLabel class made possible by Icon Factory and used in Twitterrific.
While this solution allows for links (or anything you can find with a regex) to be detected to be handled on a case by case basis, it doesn't allow for selecting and copying.
There is also an issue where if a URL is long enough to be wrapped, the button that the class overlays above the URL to make it interactive cannot wrap and draws off screen, looking very odd.
Solution 2: Use IFTweetLabel and handle copy manually
The second thing I tried was to keep IFTweetLabel in place to handle the links, but to implement the copying using a long-tap gesture, like how the SMS app handles it. This was just about working, but it doesn't allow for arbitrary selection of text, the whole text is copied, or none is copied at all... Pretty black and white.
Solution 3: UITextView
My third attempt was to add a UITextView as a subview of the table cell.
The only thing that this doesn't solve is the fact that detected URLs cannot be handled by me. The text view uses UIApplication's openURL: method which quits my app and launched Safari.
Also, as the table view can get quite large, the number of UITextViews added as subviews cause a noticeable performance drag on scrolling throughout the table, especially on iPhone 3G era devices (because of the creation, layout, compositing whenever a cell is scrolled on screen, etc).
So my question to all you knowledgeable folk out there is: What can I do?
Would a UIWebView be the best option? Aside from a performance drag, I think a webview would solve all the above issues, and if I remember correctly, back in the 2.0 days, the Apple documentation actually recommended web views where text formatting / hyperlinks were required.
Can anyone think of a way to achieve this without a performance drag?
Many thanks in advance to everyone who can help.
As soon as I hit the submit button, a new idea hit me.
I was so preoccupied with having URLs inline with text and interactive that I didn't consider that maybe it's not the best solution.
I'm certain that to achieve that kind of behaviour, a UIWebView is the best choice, regardless of the performance issues.
However, maybe a better user experience / interaction is to not highlight the URLs inline, but to gather them into an array behind the scenes, and present a disclosure button as the cell's accessory view?
Then for selection and copying text, I could just use the UITextView with data detectors turned off and not worry about the links being sent off to safari and closing my app.
When the disclosure button is tapped, the user could be whisked off to the URL found in the text, or if more than one URL is found, present the user with a picker view to choose which to go to.
Any thoughts/criticisms of this idea are welcome.
You can prevent a textfield from being edited by overriding the UITextField Delegate methods such that they do not apply any edits. That leaves the field selectable and copyable but prevents alteration.
A better question to ask is: do you actually have to display the actual URL itself? Can you get away with just a page/location name, just the server.host.domain prefix or some other condensed representation of the url? I don't think anyone whats to try to read a long url on a mobile's restricted screen.
If you do need to display the entire url then I think that a detail view is the way to go.

Best approach for adding non-web links to UITextView

I am creating a dictionary-style app that presents a tableview full of words, and when a word is selected, a UITextView is displayed that shows the definition of the word. What I would like to do is add a line that says "See also: synonym1, synonym2" where synonym1 and synonym2 are links that will take the user to the definition for the synonym that is touched.
What is the best way to add these dynamic links? Buttons? Somehow add a small UIWebView a UItable on the fly?
Thanks!
I would replace your UITextView with a UIWebView and use that contain your description text and your links. It's fairly trivial to generate HTML on the fly for something like that.
You could register a custom URL scheme for your app, or you could intercept links as they're clicked.
If your links are always grouped together there's no reason why you couldn't use a bunch of UIButtons inside a custom view, but then you'd have to handle layout and wrapping on your own. It seems a lot easier to do it in HTML.

Changing text of copy&paste buttons

I would like to localize my app but I can't figure how to change text in copy and paste and other other buttons. I tried to google but that is way too much irrelevant info about iphone copy/paste :/
any help is greatly appreciated
If you use the system-supplied controls, the localization is handled for you by Apple, as it is for other items, like Edit or Done buttons in the table views.
Ok, setting "Localization native development region" inside .plist file to preffered language seems to do the trick