Custom localisation in Flutter - 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.

Related

I want to change the DatePicker Style of UWP

I want to change the DatePicker Style of UWP as shown below.
I want year to come first and month to come second.
I modified the style but it does not work.
What should I do?
Thank you for your reply.
According to this article:
There are many different ways to properly display dates and times. Different regions and cultures use different conventions for the order of day and month in the date, for the separation of hours and minutes in the time, and even for what punctuation is used as a separator.
If you use date and time picker controls, these will automatically use the date and time formats for the user's preferred language and region. So the order is defined by the user's preferred language and region that you should not be able to change them by the style of DatePicker.
The first image you showed above seems like preferred language is en-US and home region is US. For scenarios where you provide different functionality based on the user's language, region, or cultural preferences, Windows gives you a way to access those preferences, through Windows.System.UserProfile.GlobalizationPreferences. And the second image seems like preferred language is Chinese. The preferred language can be override by property PrimaryLanguageOverride. Pay attention that the PrimaryLanguageOverride property should only be set to languages that are available for the user.
So if you change the prefer language to Chinese the DataPicker may be shown in order year-mouth-day. Also formats need be changed as the second image show. Code as follows:
<DatePicker BorderThickness="0" FontFamily="Arial Black" FontSize="15" FontWeight="Bold" MinWidth="190" DayFormat="{}{day.integer(2)}" MonthFormat="month.numeric" YearFormat="{}{year.full(4)}" />
Code behind
ApplicationLanguages.PrimaryLanguageOverride = "zh-Hans-CN";
And the result
To respect the user's Language and Cultural Preferences, this may not be recommended to change.

Why do some XIBs appear to be groups containing other files, and what is the purpose of those files

I think it is a very basic question.Some xib,plist look like a group((see this pic arrow on left)mainwindow.xib,icarouselexampleviewcontroller).New.xib file is normal.
what is the difference between this two?
where to use?
what is en?
How to create them?
It is used for Localization purposes. You can have different nibs based on the language. These just represent the different nibs for different languages. For example consider an app which has a button or image in one of its view, we can have another nib file for the same view for a different language to show the contents of the view in that specific language
go through these links
Link 1
Tutorial
I guess en is used for localization. It is used when you need to create application in a different language as per client requirement.

iPhone: Best way for user to select options in a manner similar to a HTML select?

I'm currently coding an iPhone app and i need to simulate a HTML select.
The app is a port of a web application which allows the user to select different units of measurement. For example, a user can select 'Millimetres' or 'Inches'. This is nice and simple in HTML as a select is perfect for the job, but how do i present this choice to the user of an iPhone app as there is no such thing as a select in UIKit?
The closest option (and the standard one used for such things) is a UIPickerView.
If you're after sample code, see the "Related sample code" section in the header of the above linked document.
In terms of presentation, you could use a UIActionSheet to present the UIPickerView - there's a good question/answer already for this at Add UIPickerView & a Button in Action sheet - How?
You're looking for the UIPickerView:
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPickerView_Class/Reference/UIPickerView.html#//apple_ref/occ/cl/UIPickerView

iPhone - initWithBarButtonSystemItem and language translation

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.

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