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.
Related
I have a project by my client that has built successfully in his system but as he sent to me I am unable to compile it because of unicode characters (Latin characters) in default strings.xml under res. I believe its the default localizations file but its forcing me to convert it into English but not parsing Latin Characters into it.
e.g.
<string name="old_questions">Questões e soluções dos anos anteriores</string>
Check that the XML is in UTF-8 and has
<?xml ... encoding="UTF-8"?>
or defaulted
<?xml ... ?>
I tried your text in my studio , well it is working fine. You could also update question with your error , that would help understand it better.
Another workaround for small texts would be to simply escape it.
<string name="Example">Example character \u0026</string>
go to this website : https://unicode-table.com/en/#control-character and this could help you .
Make sure your string file is in the default values folder.
You can check the android developers link for better understanding.
To help you better please post the exact error you get while compiling the code.
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'm new to Android app development, trying to follow an intro book on the subject. After creating a blank project, I'm instructed to open the string.xml file, which is supposed to contained the element <string name="hello_world">Hello World!</string> in order to edit the default text of the TextView object. However, the file doesn't contain this element. It only contains:
Also, the book only shows an activity_main.xml layout file, whereas I'm seeing both an activity_main.xml and a content_main.xml file.
Perhaps this is a version issue? My install of the Android SDK is on Windows 10 with the latest API 23, whereas I think the book was published before API 23 was released.
The default project template has probably changed since the book was written.
Try creating a new project, and when asked, choose "Empty Activity" instead of "Blank Activity". This should only include activity_main.xml
This doesn't include the hello_world string in the resources however, so just add it yourself by adding a line with
<string name="hello_world">Hello World!</string>
to the strings.xml
Moreover, they decided to break the convention they had been going with for the default template. There is a TextView in the activity_main.xml layout, but it uses a hardcoded string, rather than a string resource.
If you modify the text attribute of this TextView to: #string/hello_world, you should be able to mirror the desired behavior that the book is asking for.
Here's a page straight out from the official Android docs on String resources. It may help you understand it better: https://developer.android.com/guide/topics/resources/string-resource.html
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.
How to implement Android system l10n ?It has been l10n in German.What is different between Android and Linux in realizing system localization?
What is Operational process of implementing Android l10n ?
What is needed to implement Android system localization? such as Unicode UTF8, charset,other anything else?
Are you asking about internationalization/localization? If so there's a pretty extensive writeup in the docs.
Localization in Android is a native function, what you have to understand is how to "tell android" where to pick the words translated based on the Language that is set on the device that is running your application.
1. When developing an application for Android avoid "hardcoding" the string values and always use the strings.xml file located in the res/values folder. In that file enter every string used in your application using the tag:
<string name="app_title">Super App</string>
2. From the java side use this string resources from anywhere with the method getString(), this method receives as parameter the id of the item you want to get:
getString(R.string.app_title)
3. Once you have defined every string your app will use, just copy the strings.xml file and paste it in a new folder at the same level of the res/values folder but name it according to the new language you want to add (Read this)
4. Finally, translate every string in each folder to the proper language but keeping the same ids of every string, just changing its content:
res/values-EN/strings.xml
<string name="app_title">Best Application Ever!</string>
res/values-ES/strings.xml
<string name="app_title">La Mejor Aplicación!</string>
res/values-FR/strings.xml
<string name="app_title">Meilleure Application Jamais!</string>