android refering pre defined resources folders - android

can I change the referring a resource folders programmaticaly. I need to use a language that is not supported by android, in my case Sinhala. can I create a values_sin folder and refer it when user select Sinhala language. can I change the font together with that for entire application.

How about this: put your Sinhala strings in res/values/strings.xml, and the English strings in res/values-en/strings.xml or maybe even better, in res/values-en-rIN/strings.xml. When using the second method, your app will be in English only if the user selects "English (India)" as the phone's language. In any other case, the default resources will be used - which in your case will be in Sinhala!
Edit 2: actually, Android does support Sinhalese, using res/values-si. If you can't select Sinhalese as your device's default language, you could change it at runtime. There are plenty of posts already, such as Changing Locale within the app itself

Related

How to support Spanish and French Language in android?

I want to change the application content from English to Spanish/ French as per the selection. Do we have any build-in libraries for the same. I am new to this multilanguage part, so please help me with this.
You just need to create an additional folder like values-fr (for French) and provide strings.xml with respective values.
here you can find detailed guide:
https://developer.android.com/guide/topics/resources/localization
Create strings.xml(fr) and strings.xml(es) with your translated strings in the respective language.
Use this library to set the language in your app, it manages all the overhead of Configuration Context and other boilerplate code
https://github.com/YarikSOffice/lingver.
This how you create multiple language resources
In android studio
Res-> New -> Android Resource File->
Name the file strings.xml -> Resoure Type Should be value
Select Locale From Available Qualifiers
Select Language and Set region to be any
Click Ok

How to provide Arabic Language support in Android Application

I have made an application in android but now I have to provide arabic language support. I have checked many of answers in stackoverflow but from any answer I didn't get correct answer.
To provide localization support for different languages, we need to add the language specific resources into separate folder. For eg:Inorder to provide layouts for Arabic language
we need to create a separate folder under res folder i.e.,res/layout-ar like this.
In order to access the current language via code we can get the current language by calling
Locale.getDefault().getDisplayLanguage();
for more information look into following links:
for localization :http://developer.android.com/guide/topics/resources/localization.html
for RTL layout mirroring (Arabic like languages):http://android-developers.blogspot.de/2013/03/native-rtl-support-in-android-42.html
Also you may need to use 'onConfigChange' to your 'AndroidManifest' file with option 'locale'
I am just a beginner but I have looked this question up and came up with this:
http://marketplace.eclipse.org/content/android-string-localization#.VG5A_PmUeSp
Eclipse provides string localization. However, when it translated the strings to Arabic, I had to double check the translation because Arabic has Feminism in Grammar and also some plural forms aren't that correct.
In AndroidManifest.xml:
SupportRtL
this will enable alignments of images and text to right in Arabic and left in English
Create two string resource layouts (one English, one Arabic)
string Resource
Add the same string with the same name in the two layouts but change the value of the arabic string in the (ar\strings.xml)
Same goes to each drawable item
(Also for reference I'll add how you can create a resource that ar or RL)
creating arabic resourse
Also either in the base activity to set the base local language
app = (MyApplication)getApplicationContext();
lang = Actions.setLocal(this);using the function:
function

Landscape folder for localized layout

Due to language differences I need to have a separate landscape layout for German. How ever I created a new folder in eclipse to hold the layout but now I`m getting an error.
Is the name of the folder correct
Heres a link to a screenshot capture
https://docs.google.com/file/d/0B9OVrUvUh2stdmhkQzNFNkcxS28/edit
To support different your app in different language, you can have two options to achieve these.
A. Most Preferred way
You just need to add res/values-__/string.xml different string.xml.
To support German language you just need to add res/values-de/strings.xml which contain your string values in german which Android can display to user at runtime on the basis of their locale.
B. Increases app size as new layout created as per language.
You need to change the folder name to layout-de-land as per developer.android.com
Your link does not work but according to http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources the name should be layout-de-land
if you use multiple qualifiers for a resource directory, you must add them to the directory name in the order they are listed in the table.

Android: Regarding using different strings based on user choice

You can use strings in this way: " R.string.*" or in xml: "android:text=#strings/*" - right?
They all take their values out of a fixed file named strings where you put them all in right?
Let's say I have an app where there is the possibility to change language. Is there a way in which I can change that string file? Let's say have a strings file for English and strings for French or anything.. so i can still use the R.string.* and #string/* but I will get different values depends on the user choice?
The Developer's Guide on Localization covers this.
In short use the same string names, but have different locale folders, like:
res/values/strings.xml for the default language
res/values-fr/strings.xml for French
res/values-ja/strings.xml for Japanese
The OS will load the appropriate language for R.string.hello for you.

Need edit command in android edit text in danish language

Am doing a danish project, so when i long press in the edit text box i need the "Edit", "copy", "paste" etc commands in danish. In my phone there is no danish language can be selected.
any help is appreciated.
thanks in advance....
jibysthomas
I think you have to use Typeface for using Danish language without selecting Danish language from your phone language.
And for long press dialog I think you have to make your custom dialog and use that. I am not sure but this is my idea.
Thanks.
I use "Scandinavian keyboard " and when i need it press and hold the input box and change the "input method" to this keyboard
https://play.google.com/store/apps/details?id=com.android.inputmethod.norwegian&hl=es
hope it works 4 you
Your Android build must support each localization for the system menus to appear in the desired language. Yes it is possible to support a language by overriding the system menus but if you use Danish as your default language in the app and the system language is set to Danish the system menus will appear in Danish.
Download a custom locale app from the market and use it to change your phone locale to Danish. In your app, you then need to support localization. Read this document on localization. It helped me a lot when I was localizing an app. Briefly, you will need to create a "values-da" folder under res, create strings.xml and define the strings you need with your Danish values. Don't forget that you need to have a strings.xml file in your regular "values" folder as well with all the strings defined. This folder represents the default string values, and is useful to fall back on if a string is not found in your "values-da" folder.
Trust me, the whole process is actually a lot easier than it sounds.

Categories

Resources