iPhone - initWithBarButtonSystemItem and language translation - iphone

I use initWithBarButtonSystemItem to place some buttons in my navigationbar, but I am surprised with something : the text is not translated in the local language...
My keyboard "accept" text is in French, but UIBarButtonSystemItemSave keeps showing "Save" (in English) instead of something like "Enregistrer" or "Sauvegarder" (in French).
Is this normal ?
If yes, why use those kind of buttons instead of initWithTitle ones ?

I found the solution of the problem.
To make the translation work, you must define the languages to your project : Go to the project properties, and in the info tab, add the desired languages. Then, the System buttons will be localised on systems that use those languages. if you just let "English" as the sole language, for exemple, the System buttons won't be translated even if the app is launched on a Spanish, or French OS.

Related

Custom localisation in Flutter

There are options to select an language from the list of Language in my application i.e. English, Gujarati, Hindi.
After the selection, all the texts inside app should change and display according to language selection.
Note that This is not normal localisation (means selecting language from settings and then it reflects in app)
The question is How can I change the text content according to selected value of Language?
Thanks.
You can use this article: https://medium.com/#podcoder/flutter-localization-a39402757a42 (https://github.com/podcoder/flutter_localization)
This is an easy way to localize an application without using the system language.
Hope this helps.
I am currently using this method and it works very well.

Iphone SDK, switch keyboard in app

I have one question, may be it is very simple, but I do not know about this nothing...
For example, I have an application, application with textfield, I want to know two things.
First: Is possible to switch keyboard when application in runtime?
Second: how I can switch type of keyboard(Russian, English, Swedish, etc.) in my application*?
*-without going to Settings->General->Keyboard->add new keyboard.
Not sure about changing languages (I did find this other post about it: change input source language programmatically OSx), but changing the keyboard is pretty easy. Here is a one line example:
textField.keyboardType = UIKeyboardTypeURL;
Take a look at the UITextInputTraits protocol reference for more info. Then the question comes in where to implement this. I am assuming that you want to check conditions right before the keyboard comes up, you may have to implement UITextFieldDelegate protocol (and maybe using the field's tag to see which field the cursor is in).
Hope this helps.

How can I change the language of the displayed UIKeyboard from within my iPhone app?

Within my iPhone application, I'd like to change the language of the displayed UIKeyboard. How can I do this?
From the iPhone Application Programming Guide:
Depending on the needs of your program and the user’s preferred language, the system might display one of several different keyboards. Although your application cannot
control the user’s preferred language
(and thus the keyboard’s input
method), it can control attributes of
the keyboard that indicate its
intended use, such as the
configuration of any special keys and
its behaviors.
[...]
To facilitate the language preferences
of different users, iPhone OS also
supports different input methods and
keyboard layouts for different
languages, some of which are shown in
Figure 5-4. The input method and
layout for the keyboard is determined
by the user’s language preferences.
So it appears there's no way to bring up a keyboard of a different language than the user's preference.
really cant do it programatically, the user must have that keyboard enabled and then they can get to it, you can maybe tell the user they require a non english keyboard in an alert view or something like that.
NSString *iso631Code = #"zh";
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:iso631Code] forKey:#"AppleLanguages"];
gives me a Chinese (pinyin) keyboard (you can even dynamically switch between say #"zh", #"fr", #"en" without having to restart).
see also How to force NSLocalizedString to use a specific language

Is there an iPhone equivalent to the NSTokenField control?

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

Controlling initial shift status (and layout?) of iPhone keyboard from web form

I would like to be able to control the initial shift state of the iPhone keyboard from a Javascript prompt (updates added for web forms). It seems to mostly default to an initial capital but I feel sure I've typed into/seen prompts that are initially lower-case. I also feel sure that I've seen custom layouts used from the web.
Googling around initially (see updates) didn't reveal any obvious documentation or previous answers besides saying that having "phone" or "zip" in the class of the input would bring up the numeric keyboard (although this may have stopped working). Apparently "url" or "email" could select the appropriate layouts also. This obviously doesn't apply to javascript prompts, and may not work in some versions.
Is there any official source for all this stuff? Does it work across all firmware versions? Has anyone got a general solution for changing keyboard layout or for doing this in Javascript prompts?
UPDATE
For web forms: found this from Apple straight after posting the question, along with this. The question still stands for Javascript prompts.
UPDATE 2
Doh! This is also useful; placeholder text and search button not mentioned in the Apple links. Some more relevant info here.
How do I control which keyboard is displayed when a user touches a text field?
You can control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "\d".
These keywords and the pattern attribute are part of HTML 5, and are available in iPhone OS 3.1 and later. See Listing 15 to see how to display each type of keyboard, including the standard keyboard.
Listing 15: Controlling keyboard display
Text:
Telephone:
URL:
Email:
Zip Code:
See http://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/index.html