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
Related
I am new to android studio. I am trying to create an application with localisation(Tamil). When I paste my Tamil language into android editor the font is not appearing as it should. Here is the Screen shot of my android studio
Already surfed lot here. There is no answer for this issue. It would be great if anyone help on this.
When i tried to generate that same condition I came to know that you haven't added that string named "app" in your default locale i.e. in strings.xml and you are directly trying to add a translation for it.
When u hover to that error it states:
app is transalted here but not found in default locale.
First add(create) that string in your strings.xml file and then try to add it in your strings.xml (tamil) file.
Follow these steps:
First go to your project's res folder --> then open values folder --> then open "strings.xml" file and remove all text inside it and paste the text shown below:
<resources>
<string name="app_name">My Application</string>
<string name="tamil_app_name">ஆங்கில தட்டச்சு வழியாக நம் மொழி</string>
</resources>
Because you have to create a Tamil language string file to set your language. please do the following steps-:
1) Firstly declare all the strings in main strings.xml
2) Then create the string file according to your language choice, Example strings.xml(ta)
3) (ta) is the language code accordingly.
4) The Strings that you have in your main string file convert them into particular language which you want then paste it into the new created String file.
I am intented to write Iniciar sesión, but the ó not working. For this reason I changed to ó but is another error.
<TextView
android:id="#+id/textView"
android:layout_width="330dp"
android:layout_height="24dp"
android:text="Inicio de sesión"
tools:layout_editor_absoluteX="27dp"
tools:layout_editor_absoluteY="28dp" />
¿I must configure Android Studio?
I added compileOptions.encoding "ISO-8859-1" in build.gradle but the error persist.
Help me, please.
Thank you!
To fix this issue, you have to create a Strings.xml file and add to it and qualifier (Spanish language) then you can add this letter with accent without any problem
<resources> <!-- spanish language qualifier -->
<string name="test_text">Iniciar sesión </string>
</resources>
You can read more about qualifiers in the oficial documentation here:
Qualifiers
You should avoid to use text like this, directly on your layout file. Instead of it, you should relay on the file string.xml where you define all the texts your xml files will need to display. By doing this, you will be doing nothing less than the correct specification from Android makers in order to localize your app (more info on this: https://developer.android.com/guide/topics/resources/localization.html ).
So, proceed this way:
1) on your res folder there is another one called values. There you will find your strings.xml file. Open it and create a new key, let's call it txtarriba, like this:
<string name="txtarriba">Begin of session</string>
2) with android studio or your regular file manager, create another folder below your res folder, call it values-ES.
3) inside values-ES create a new file named strings.xml, there you will insert the translation of that key txtarriba. So do this:
<string name="txtarriba">Inicio de sesión</string>
4) Then, on your primitive layout xml file you define your textview like this:
<TextView
android:id="#+id/textView"
android:layout_width="330dp"
android:layout_height="24dp"
android:text="#string/txtarriba"
tools:layout_editor_absoluteX="27dp"
tools:layout_editor_absoluteY="28dp" />
DONE.
With this you can assure you app is, from now on, correctly showed according to your device idiom. If your device is in english, Begin of session will be showed. If device is set with spanish language, you will read Inicio de sesión. With this you can forget all the troubles about special chars, Android manages this for you ;)
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 two string xml for two different languages, I would like to know the different between those xml files.
For example, there is one xml for English,
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Keep Accounts</string>
<string name="insertNewOne">Insert Accounts</string>
<string name="browseRecord">Browse Records</string>
<string name="set">Setting</string>
</resources>
And another xml for other language,
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Example</string>
<string name="insertNewOne">Example</string>
<string name="browseRecord">Example</string>
<string name="dateNoColon">Example</string>
</resources>
We can see the difference is xml for English has element string name="set", and the other has not. On the other hand, the xml file for other language has element string name="dateNoColon" but the xml for English has not.
In this case, I would like to know the English xml lacks the element string name="dateNoColon", and other xml lacks the element string name="set".
Android Studio has translations editor starting of 0.8.12 version. You can find there missing translation strings.
You can enable check for missing translations in Lint tool. There are "Missing translation" and "Extra translation" checks.
Extra translation If a string appears in a specific language translation file, but there is no corresponding string in the default locale, then this string is probably unused. (It's technically possible that your application is only intended to run in a specific locale, but it's still a good idea to provide a fallback.).
Incomplete translation If an application has more than one locale, then all the strings declared in one language should also be translated in all other languages.
Suppose if the device is set to Other language, Android will look for title in the otherlanguage.xml file in value folder. But if no such string is included in that file, Android will fall back to the default, and will load title in English from the english.xml file.
For more detail go to http://developer.android.com/guide/topics/resources/localization.html#using-framework
I wrote a small tool for that: resdiff.
Check it out! https://github.com/danijoo/resdiff
Try sorting both files using some perl or bash script or something like that for example, using bash:
sort temp.txt -o temp.txt
and then look at the diff for example using DiffMergeit.
Use Android Lint to find both incomplete translations i.e. strings missing in a language variant and extra translations i.e. strings introduced in a language variant but missing in the default locale.
In Android Studio you can run Lint (and some other analysis tools) with Analyze -> Inspect Code.
I tried to build an android application, when I use non-english langues like persian as name of application it causes this error AndroidManifest.xml file missing and no manifest builds but when I use english it works successful, why?
at the top of every XML file in Android you'll see
<?xml version="1.0" encoding="utf-8"?>
So first I ask you: is persian included in utf-8 encoding?
I had a quick look on this link http://www.utf8-chartable.de/ and it seems to be me that's a no but I'm no language expert and that table might show persian as one of it related or base languages (like portuguese uses latin set)
If persian is not available in the utf-8 your best option to try to get this name in the app name is to create a strings_per.xml (inside the /values/ folder) and in there you put a different encoding and the string you need for the app name.
note that I tried to isolate the problematic variable in its own file because I'm not sure it would be a good idea to mix it with the rest of the manifest.
Farsi IS included in UTF8.
You need to add a string in strings.xml in /res/values.
Then define a farsi name there.
Your string.xml will look like this:
<string name="app_name">اسم اپ</string>
<string name="title_tab1">تماس با ما</string>
<string name="action_settings">Settings</string>
And you will reference it in you manifest.xml like this:
android:label="#string/app_name"
But remember: Farsi characters are not perfectly shown in android 2.2 and 2.3.
The characters are displayed separately. For later androids this is not an issue.