Mainfest:
<application android:name="org.qtproject.qt.android.bindings.QtApplication"
android:label="#string/app_name"
...
<activity android:name="net.mynamespace.MainActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="#string/app_name"
...
res directory contains Russian translation:
values/strings.xml
values-ru/strings.xml
values/strings.xml content:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">English App Name</string>
</resources>
values-ru/strings.xml content:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Russian App Name</string>
</resources>
but devices with Russian language still display English app name.
What can be wrong?
Tried values-b+ru but it did not help.
If I copy values-ru/strings.xml to values/strings.xml the app name is displayed in Russian.
Did a quick Google search, but with no success:
How can I translate my Android app name?
Support different languages and cultures
Using resources for localization
What is the list of supported languages/locales on Android?
it helped me that I commented out this line in the android/build.gragle file:
defaultConfig {
//resConfig "en" //this one
minSdkVersion = qtMinSdkVersion
targetSdkVersion = qtTargetSdkVersion
{
And I also created two additional folders, in addition to the already existing android/res/values:
android/res/values-en
android/res/values-ru
In each of the three folders, I put a strings.xml file to make it look like this:
android/res/values/strings.xml
android/res/values-en/strings.xml
android/res/values-ru/strings.xml
Each file must contain the name of the application corresponding to the language described by two characters in the name of the folder in which it is located.
Related
I'm developing multi language android app.
I'd like to start app from Android Studio Run button with specified language.
Is it possible?
I'm expecting any option.(like Application Language in Xcode Run Options)
Why do I want this?
I'd like to check my app's layout and word, But Launching 'Settings app' is annoy. So I am looking for easy way to change device language setting OR Android Studio Run app options that can specify language each Running.
Thank you.
Generic file /values/strings.xml, will be used when locale does not match with one's present in your app. To create locales see these examples.
Please note that you have to create folders for each locale like value-de for German language, then create strings.xml file inside.
Generic strings.xml file:
app/src/main/res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Spin The Bottle</string>
<string name="text_hint">Tap on screen to spin the bottle</string>
</resources>
For Arabic language:
app/src/main/res/values-ar/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_hint">اضغط على الشاشة لتدور الزجاجة</string>
</resources>
For German language:
app/src/main/res/values-de/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="text_hint">Tippen Sie auf den Bildschirm, um die Flasche zu drehen</string>
Remarks
It is not necessary to translate each and every <string> inside strings.xml.
Notice I have placed translatable="false" on app_name as I wanted my app name to show the same for all locales.
Also app_name is not included in any other locale except generic values folder.
I have this in Android Manifest:
<application
android:label="#string/app_name"
...
</application>
and in strings.xml:
<string name="app_name">My App Name</string>
Everything ok. Now, my problem is that I'm using an aar dependency whose strings.xml file contains an item named app_name, too.
<string name="app_name">My Library Name</string>
And my project is using the second one instead.
How can I solve this conflict?
A unique resource name for the element, which you can use to obtain a
reference to the View from your application.
For better way , Just use Different String Name .
**Its very easy change key value app_name as per your way**
example
change strings.xml
<string name="app_name">My App Name</string> line like
<string name="my_app_name">My App Name</string>
Then in manifest file use
<application
android:label="#string/my_app_name"
...
</application>
How can I name an app with a different name for different languages?
I am using Unity3d v. 5.2.3f1 Personal.
If it doesn't already exist, create a folder \Assets\Plugins\Android\res\values-xx for each additional language you want to support. Substitute "xx" with the two letter language ( not country! ) code.
Also make one without a language code ( \Assets\Plugins\Android\res\values ) which will be the default one, if your device doesn't match any of the languages you created.
In each of those folders, create an xml file called strings.xml containing this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hello World</string>
</resources>
Resource- http://www.bitsofbas.com/blog/post/32/localizing-app-name-in-android
Update:
The folder name for localized strings should be like this scheme:
<resource type>-b+<language code>[+<country Code>]
e.g. values-b+es/ … for spanish language
Docs: Support different languages and cultures
How can one directly input Hindi text into the eclipse IDE on android?
I would like to type Hindi text directly into the eclipse IDE without copy/pasting it from somewhere else, see this demo for an example of writing Hindi text quickly.
I would like to do the same thing in the eclipse IDE.
Use hindi texts inside String.xml file like
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hindiText"> पवन कुमार</string>
</resources>
And use this on your app's TextView
<TextView
android:id="#+id/textView"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hindiText"
android:textSize="28sp" />
Yes Hindi language can support in Android devices. You need to follow the steps.
Step 1:
Just create one values folder under resources like values-hi and add strings.xml file inside of this folder. You can add your translated strings in this strings.xml file.
example
<string name="your_text">अपका संदेशर</string>
Step 2:
If you call your strings from the other layout xml files then just call like the following
android:ext="#string/your_string"
Step 3:
You can also use string values in java code programmatically.
I think you are looking forward for multi-language(English AND Hindi) support for your application. If so,
strings.xml in values folder
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="welcome">accueil</string>
<string name="email">adresse e-mail</string>
<string name="password">mot de passe</string>
<string name="login">connexion</string>
<string name="signup">Ne pas avoir un compte? signer</string>
</resources>
strings.xml in values-hi folder
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="welcome">स्वागतम</string>
<string name="email">ईमेल पता</string>
<string name="password">पासवर्ड</string>
<string name="login">लॉगिन</string>
<string name="signup">खाता नहीं है? साइन अप करें</string>
</resources>
for more references please check this link
EDIT (as per the comment)
Try this
1.Windows > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types.
2.Windows > Preferences > General > Workspace, set "Text file encoding" to "Other : UTF-8".
For more references, please check this
blog
Use UTF-8 encoding in android studio , below is setting page , using
utf-8 encoding will allow you to paste hindi fonts in xml and java
code.
For Eclipse IDE : below is path to configure the encoding :
Preferences > General > Workspace > Text file encoding
Today i found solution of my question.
i found that Google develop many inputtools for windows OS , Android
and for Web in many language that use for fastly type any language with the help of English typing.
So i download inputtools at URL : Download Page thank you Everyone for help me
How do I determine the language setting of an Android device. I am doing this to internationalize my app. Thanks!
You have to use different string.xml files
res/
values/
strings.xml
values-es/
strings.xml
values-fr/
strings.xml
Refer below link
Supporting Different Languages
And also Read Localization
The most common to do this is to keep a string file with the strings you want to localize in the res/values folder. You can then create additional values folders marked with resource qualifiers that will contain localized string files.
For example, if you want to translate to german, you create the res/values-de folder and put your localized string file in the folder. Android will load this folder automatically if the language is set to german. If the current system language has no values folder, it will use the default res/values folder.
There is a very simple method: right click on the strings.xml file and select Open translation editor or click on open editor.
You will see the different entries appear in the strings.xml file. By clicking on the icon representing the Earth (Add local), you can add a new language and enter the translation of the entries as desired.
When this is done, you should see a new strings.xml file appear in the tree window, accompanied by the flag of the chosen language and the extension of this language in parentheses.
You just have to compile and test the application on your emulator, by testing different language choices on it.
Create values folder for different language and put this language String.
example : values-ca and put Canada language String in this folder.
So, if user change the phone language then it is show this country language.
Thanks.
You have to use different string.xml files
res/
values/
strings.xml
values-hi/
strings.xml
<resources>
<string name="welcome">स्वागतम</string>
<string name="email">ईमेल पता</string>
<string name="password">पासवर्ड</string>
<string name="login">लॉगिन</string>
<string name="signup">खाता नहीं है? साइन अप करें</string>
values-gu/strings.xml
<resources>
<string name="welcome">પધારો </string>
<string name="email">ઈમૈલ નું નામ</string>
<string name="password">પાસવોર્ડ</string>
<string name="login">લોગીન</string>
<string name="signup">એકાઉન્ટ નથી ? સાઈન ઉપ કરો</string>
values-ja/strings.xml
<resources>
<string name="welcome">歓迎</string>
<string name="email">電子メールアドレス</string>
<string name="password">パスワード</string>
<string name="login">ログイン</string>
<string name="signup">アカウントをお持ちでない場合は?サインアップ</string>
values-ja/strings.xml
<string name="welcome">Willkommen!</string>
<string name="email">Email Addresse</string>
<string name="password">passowrd</string>
<string name="login">Login</string>
<string name="signup">müssen nicht angemeldet? Anmeldung</string>
Do you really need this to do manually? Actually in android are already built-in internationalization mechanizms - resource qualifiers.
All you need to do is add specific strings.xml for each locale.
http://developer.android.com/guide/topics/resources/localization.html