Using miles or kilometers in Flutter application? - internationalization

Greetings Flutter Devs,
I'm writing an internationalized app and trying to determine whether to use miles or kilometers based on the locale. Currently I can only see the country and language from the locale data structure. Is there a way to determine whether the app should use miles or kilometers?
Thanks!
James

https://docs.flutter.io/flutter/widgets/MediaQueryData/alwaysUse24HourFormat.html
Whether to use 24-hour format when formatting time.
The behavior of this flag is different across platforms:
On Android this flag is reported directly from the user settings
called "Use 24-hour format". It applies to any locale used by the
application, whether it is the system-wide locale, or the custom
locale set by the application.
On iOS this flag is set to true when
the user setting called "24-Hour Time" is set or the system-wide
locale's default uses 24-hour formatting.
See also https://docs.flutter.io/flutter/widgets/MediaQuery-class.html

Complementing Günter response - afaik only USA, Myanmar and Liberia uses the imperial system. Please correct me if I'm wrong.
You can use the following snippet Localizations.localeOf(context).countryCode to get the current country code.
Click on the following link to get more information.

Related

How to Localize Xamarin Android DatePickerDialog

I have a datePickerDialog to show and it must be localized.
What is the easiest way to do it?
Also I am doing the app to support the language that is not supported by android system yet.
I am ready to create each resource file for strings for translated values but is it possible to achieve this only buy adding resource files?
Maybe adding string values with keys that DatePickerDialog refers at runTime by current culture so it will take my localized values instead of default

Changing sap ui5 application locale dynamically in the application

I have two different language i.e English and German in my web app and user can change the language in application through a select box. Initially i am getting preferred language from the back-end and i am setting locale of the core as follows.
sap.ui.getCore().getConfiguration().setLanguage("//according to whatever is coming from back-end")
Now lets say initial language is English, if user open a control i.e sap.m.datepicker, calendar is being displayed in English. If user changes the language to German from the application i am again changing the language in the core as shown below:
sap.ui.getCore().getConfiguration().setLanguage("de-DE")
Now if user opens that same datepicker, it is being displayed in English instead of German and if user opens some another control or datepicker it is being rendered in German.
Page is not getting refreshed while changing the language in app.
Please suggest me a solution to dynamically change the locale of the controls.
Maybe my answer here helps a little.
The problem is that in many cases, maybe even in most cases, the standard UI5 controls detect the language only once when they get loaded. Very often, the control developers did not implement a "dynamic change" of the language. If you check the link I mentioned above you will see that there are ways to react on language changes, but very often this is not implemented for whatever reason.
However, I'm afraid to tell you that in your case the standard control might not support dynamic language changes out of the box (but I did not check the code). Also, it seems that the UI5 guys at SAP do not consider this as a bug (see this github issue). Such a pity...
I would suggest you use sap.ui.core.Core.attachLocalizationChanged(fnFunction, oListener) and add this to the onInit function of your controller.
From this, in your fnFunction rebuild the controls where you require the locale changes to be dynamic.
example:
onInit: function(oEvent) {
sap.ui.getCore().attachLocalizationChanged(this._handleLocalizationChanged, this);
},
_handleLocalizationChanged: function() {
// ... Some logic to re-build / set locale for the dynamic controls.
}
This is my interpretation of what should be done based on the information in the api

Change firefox spell check default language

Firefox has come to believe that my default spell check language should be Spanish. My global preferences have English selected:
Preferences->Content->Languages->English [en]
and on a page-by-page basis I'm able to reset the spell checker language via:
Right click->Languages->English (United States)
However, for newly opened pages or new sessions the default spell check language returns to Spanish. I found a workaround here:
https://support.mozilla.org/en-US/questions/975459#answer-494574
Which suggested that installing a new dictionary would change the default. However, this issue has bugged me for so long that I would like to know if there is a more "correct" way to change the default spell check language.
If you only use system wide spell checking dictionaries (for example, the hunspell package provided by your Linux distribution) Firefox seems not be able to remember the default configuration (is this a bug?). You can fix this issue by having at least one dictionary installed as a Firefox plugin.
Afaik, there is no UI for this. Instead you have to use about:config and set dictionary.spellchecker.
Also, Content > Languages has no bearing on spell checking. This effects what content you're given on multilingual websites.

MvvmCross localization: switch at runtime

Is there a way to change the current language to another one at runtime ?
For example: be able to switch when a button is clicked or when starting the app, get the user language and switch.
How to tell the plugin to check the user language at startup ?
Thanks in advance for your help.
Is there a way to change the current language to another one at runtime ?
yes, call builder.LoadResources(whichLanguage) on your MvxTextProviderBuilder.cs
For example: be able to switch when a button is clicked
The UI framework isn't really setup to perform switching live. When you switch between languages then the new JSON resource files will all be loaded OK - but existing displayed text will not be updated. This is a bit like most mobile operating systems - if you want to switch language you often need to reboot!
If you wanted to add dynamic switching then you'd have to find a way to tell the UI to completely refresh all text - I suspect this wouldn't be hard to do, but it might require some manual coding on every page/View which has already been created and displayed :/
or when starting the app, get the user language and switch.
This is a much more straight-forward way to do i18n. It's normally OK because MvvmCross mainly targets phones - and phones are normally single user devices which don't switch languages very often.
You could, for example, use some variable (e.g. System.Globalization.CultureInfo.CurrentUICulture) to work out the best language to display.
Or you detect on load whether the user has picked a language yet - if they have, then show HomeViewModel - if they haven't then show a LanguagePickerViewModel - this is what we did in StarWarsKinect - the StartNavigationObject is a perfect place for this sort of logic!
How to tell the plugin to check the user language at startup ?
Currently, you'll have to code this logic as part of your app startup.
I'd definitely be open to providing an improved plugin on this - perhaps with a demo!
If you are looking at i18n, then one alternative implementation to consider is Vernacular - the team at Rdio have a very good offering for Mono and MS platforms - https://github.com/rdio/vernacular

How To: Change application name based on phone language setting

I have noticed that when i change phone settings, that some of the applications on the phone change their name based on selected language.
eg. Where you change phone settings is Settings (english), Parametres (french), Configuracion (spanish)
Does anyone know how to do this for my own application?
I can change the strings inside my application. I want to change the application name that is displayed beside (or overtop) the application tile.
Microsoft wrote a detailed guide on how.
And yes, it's a C++ satellite DLL. You're not reading it wrong.
Consider using Patrick Getzmann's Tool to automate the satellite generation

Resources