I ran into a problem with default locale/language in EditText.
The default keyboard language does not match the system language and locale
Locale.getDefault() // "russian" For text input cyrillic i need to switch the language English->Russian. Reading the documentation I could not find how to set the default keyboard language. I hope you give me an explanation in this regard.)
As far as I know that is not possible.
You are trying to force the user to input only in russian.
You shouldn't do that because of the user experience.
Also, the language may not be installed on the user's keyboard and that may lead to the crash.
Related
The default language for my android app is English and the respective strings are stored in the default /res/values/strings/strings.xml
Now I wanted to support the french language so I opened the Translation Editor and added the translations for French (fr) locale.
But there seems to be multiple locale variants of french language(i.e. French in Algeria, French in Belgium ... etc) and I didn't added the translations for all these.
I just wanted to know, what language is shown to the users who has French as the default language on their devices but with a specific locale for which I don't have the specific translations.
When a user has a more specific locale specified than the app does, then the localization should "fall back" to basic language definition, in your case, "fr."
You can test these things in a simulator.
As you know, this already happens with English, your default language... and you weren't worried about what happens if someone is set to en-GB, or en-AU.
I have an Android application in which I have given an option for the users to select the language. In my app I have given Hindi and English language when the user selects the language Hindi it shows the Hindi strings perfectly.
But what I want to do is when the user selects Hindi language the input type (keyboard) should also changes to Hindi. I can use custom keyboard inside my Android app.
i.e. If a device is running in a particular language (Say Spanish) then how can I set the Spanish language(After translation) as the default language of the app without asking the user.
The app should initialize in the Spanish language in this case while installation and a user should be able to change the language from the setting page of the app.
You need to add all string.xml files in specific language values folder.
So when your user change mobile default language your app may take string values from that particular language values strings.xml file.
By Locale, you can get a currently selected language of a device. Please have a look below code to get the language.
Locale.getDefault().getDisplayLanguage();
I am creating an application in which i have given an option for the users to select the language. In my app i have given Tamil and English language when the user selects the language Tamil it shows the Tamil strings perfectly.But what i want to do is when the user selects Tamil language the input type(keyboard) should also changes to Tamil even if the user doesn't have any Tamil keyboard application.
Can anyone tell me how can i change the keyboard input to the selected language using locale in android.
The input type depends on the user's phone or tablet, if they have the Google Indic Keyboard and have selected Tamil as an optional language then only they will be able to input Tamil. You can prompt the user to download the Google Indic Keyboard app and select Tamil language. Here is the link -
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiXvbqLk9DQAhXGs48KHYs7AvkQFggcMAA&url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.google.android.apps.inputmethod.hindi%26hl%3Den&usg=AFQjCNGp4o8Sx51FsUibPbqog_lFETEwjA
I am using Hindi fonts in my application by using the following code as:
Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/DroidHindi.ttf");
txt.setTypeface(font);
Now I wanted to take input from the user in an edit Text box in hindi language..So for this, Hindi soft keypad is required , can anyone pls guide me how to add hindi language soft keypad?
It depends entirely on the user's choice of keyboard.
To test Hindi input, download one of the Hindi IME available on the market, such as PaniniKeypad Hindi IME, or get GO Keyboard and "Hindi for GO Keyboard", all of them available on the Android Market for free.