What is the status of Right To Left languages on Android? - android

I need to create an application that has strings of many languages, including RTL (right-to-left ) languages. I want to know what is the current status of RTL (Right To Left) support on Android (even on latest API), for example:
is it possible to dynamically/statically check if the device's current language is RTL type? I know that it is possible to get the current locale, but i need a more general way to check if the current language is RTL. For example, for English and French it will return false, but for Arabic and Hebrew it will return true.
is it possible to set a layout to automatically be mirrored for RTL languages ?
For example, if a linearLayout (with horizontal orientation) had its children 1->2, now it will have 2<-1, and new children will be created on the left.
is there a qualifier to add to the resources folders that will handle all RTL languages? For example, "res/layout" is for LTR (Left To Right), and "res/layout-rtl" is for RTL languages.
it seems that eclipse's content assist suggests "android:layoutDirection" for linearLayout and "android:textDirection" for textView, but when I choose them, I get a compilation error that it doesn't recognize them. I also can't find out more information on the internet about those attributes. What do they mean, and how come I can't use them?
EDIT: seems that Android 4.1 has some improvement on RTL languages. Wonder what are they and where I can read about them.

Starting with android 4.2 , there is a little more info known about the special RTL attributes , and there is even an option to mirror layouts automatically for RTL languages .
More info can be found here .
Hopefully , they will add more information about how to use it , including some sample code and maybe even a support library on this matter.
EDIT: now they've added some more information of how to use the new RTL support:
http://android-developers.blogspot.co.il/2013/03/native-rtl-support-in-android-42.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+blogspot/hsDu+(Android+Developers+Blog)
I wonder though if the NIKUD ( Hebrew equivalent to vowels, except that they are optional and they are shown as dots instead of letters) works fine now .
EDIT: Now i've tested it, and it actually works really well (this is the first chapter of the holy bible) :

RTL support in android got some improvement in ICS.
Before that in gingerbread, it was device specific e.g. each manufacturer/operator implemented their own BiDi solutions which caused some inconsistancy in applications
its not needed. Good BiDi knows to mirror text view and canvas.draw text by initial letter utf8 code.. which let you worry less about BiDi and more about your app. Just don't force gravity and fill parent on text view
No, there is qualifiers for Arabic/Hebrew etc.. where you can change practically everything. But good device implementation will not need anything but translations.
that may happen if you have some old or device specific API installed. Therefore it won't work android-wide and cause compilation errors.
But there are more reasons for it to happen...
Generally I advise you to ignore the BiDi issue for two reasons:
people from countries that use rtl usually have devices which process it pretty good if not then its their problem.
fixing your BiDi for one device will cause other devices not to comply. And that's something was done year ago.. and luckily developers finally stopped doing this mistake

Related

Delphi Arabic character display issue on android

i am using arabic characters for the first time in my app
this is how they should look like :
But this is how they end up :
things i tried:
changed the phone language to arabic.
i chose this font :Arabic type settings. i found in the fonts list
things works well for windows, its only in Android i get the problem.
i believe i am missing something because i never used arabic in apps before.
i appreciate your help.
Fire Monkey does not support right-to-left languages like Arabic. Unfortunately your chosen framework is not capable of meeting your needs. You will need to find a different tool to write your app.

Change language of SwitchPreference

I have an Android app which is only available in English. Accordingly, all of the UI that's under my control appears in English only, regardless of what language the user has set their device to. The issue is with SwitchPreferences on my app's Settings screen; the "on"/"off" labels on the switches themselves are getting localized, presenting the user with a mixed-language UI.
See screenshot at https://drive.google.com/file/d/0B5ry4aCYVaqoUkFlZW9XT2VLVFE/view?usp=sharing
Is there any way to override the system localization of this element?
Notes:
I'm not that bothered about this myself, but the app is being rejected by Samsung's app store certification team on this basis. So I do need to fix it if possible.
Please don't respond by saying "localize your app so that there's not a mix". Apart from other localization issues (which are out of scope here), it just isn't possible for me to localize to all the langauges that the Android OS supports.
Thanks for the suggestions, Mark, but it turns out there's an easier way. I just added the following attributes to the SwitchPreference elements in the XML which defines my settings screen:
android:switchTextOff="OFF"
android:switchTextOn="ON"
Voila, the switch labels are un-localized. RTFM FTW! :^)

How can I detect system Chinese, Korean, and English fonts without embedding one for each? (AIR mobile on Android and IOS)

My learning app requires displaying Korean, English and Chinese. One solution I have is to embed a Korean/English font and a Chinese font. Then put together a string with different TextFormats.
The thing is, I'm positive that IOS and Android devices should contain native Chinese, Korean and English fonts already, and I'd much rather refer to and use those fonts instead of packing them.
I tried detecting fonts by using Font.enumerateFonts(true), but when I use font.hasGlyphs('你'), I don't get a true, or anything, so I don't know how to choose the proper device font.
If that doesn't work, is there a font that contains all of those Characters? Or maybe a font-builder program that'd allow me to customize a font to include
This was something that I wrote sometime back
http://blogs.adobe.com/airodynamics/2012/08/21/supporting-languages-with-unicode-characters/
Hopefully it helps you
You can always know the name of font specific to the language. May be this http://support.apple.com/kb/HT5878.
Now based on the language you want to show just change the value of font in the statement format.font and the correct language should come up.

Indic languages on Android browser/GUI (Gujarati) improper rendering

I have a website specifically for viewing on Android devices, I am using Gujarati languages and i have a big problem rendering the Gujarati Fonts properly, I atleast want a workaround to get the Gujarati fonts Working properly which is by default not supported on any Android versions. And so i did,
The Work around:
- Rooting the phone
- Finding the correct unicode font for Gujarati language
- Replace the existing DroidSansFallback.ttf in System/fonts with the Gujarati Font (with some extra changes in fontsfallback.xml in system/etc folder for ICS)
This Helped me to atlest view Gujarati texts, but not correct rendering.
The Problem:
1) Problem of Half forms, the half form letters are not rendering properly as they are suppose to combine but they dont,
If you refer to this faq on unicode.org, it clearly defines how it should render,I have also used the mentioned "Zero Width Joiner" by using html codes for every letter using [unicodeLookup][7] but it has no effect.
Anyways This problem is not primary as it is improper but still not incorrect.
2) This rendering problem makes the texts print incorrectly, See the two images below, First one is correctly render as visible on PC and second on is a screenshot from Android native browser
image
the problem marked as 1 are fist problem and the one marked as 2 are second problem, if you google "Devanagari - Unicode Consortium ch09" you will get a pdf refering to this problem (just goto "Figure 9-8. Rendering Order in Devanagari") which clearly explains the method to render the scripts correctly. It seems what ever android uses to render the scripts is not supported for such languages, if there is any change that can be made to Android OS to render the fonts in correct order, please help.
This is definitely not a problem with fonts as i have tried using Shruti fonts which is used by windows OS, it is a problem with rendering these complex scripts
Possible Solutions: (unwanted)
1) Using opera mini with bitmap fonts (not my solution)
2) Use Images instead of texts (again not my solution as my site will have 300 lines of lists and that too for mobile, do not want to increase page size)
Please give me a proper solution to this problem, thanks in advance !!
Rendering Gujarati (and other "complex" scripts, i.e. those which use half-forms, contextual forms, rearrangement, etc.) requires more than just fonts; it also needs text layout. Text layout capability is normally supplied by the host operating system or in some cases the application. Android has been improving text layout support, but even the latest version is still not complete for all scripts. In other words: you cannot easily fix this with fonts alone, even for recent versions of Android.
Possible workarounds:
develop some kind of plugin or extension that does correct Gujarati layout and require users to download/install the plugin to use your site. This will likely be a very high-impedance path, requiring a great deal of expertise in fonts, software development, and knowledge of the target writing system. Not to mention the inconvenience for your users.
develop a custom version of a Gujarati font and use corresponding custom text in your site that does not require text layout; supply the font via #font-face (webfont). This will also likely be fairly challenging if you do not have experience with font development, but would probably be the best path.
render the text to images; do browser-sniffing and supply images for cases where the client is known not to support complex scripts. This is likely to fail much of the time (hard to keep track of browser capabilities, not to mention the problem of reliably detecting browsers to begin with). But guaranteed to give the right results.
If you want to view your website in all devices just put webfonts in the your website. web fonts are embedded fonts that you put on your server and with proper css link everybody can view that without installing the fonts on devices.
For other websites not having web fonts use firefox for android and then get addon https://addons.mozilla.org/en-us/android/addon/gujarati-fonts-package. Now you can view all webpages in Gujarati fonts without any complex procedure or root the android.

Android - Hindi Conjuncts Support?

I do understand that Android device still doesn't support complex hindi conjuncts drawing, though we set the textView typeface to a commonly used hindi font (mangal.ttf or DroidHindi.ttf).
One of the Ex:
1st 2nd Conjunct
प् र = प्र
"प्र" is been shown as...प् र { list of frequently used conjuncts - link)
What I would be interested to know is - Though android devices(I am using Galaxy-SII, os2.3) doesn't support it yet, is there a workaround for this?
Similar questions (but no workaround yet):
Android: unable to show correct hindi words
How can i show HIndi text in Android Tablet
For the question-2: #Sahaja does mention that android device doesn't support hindi complex conjuncts drawing. So does it mean that we won't be able to do anything in this regard until android adds the support for it or can we have a feasible workaround?
One workaround, which I can think of:
Convert the whole hindi database into a custom non-unicode format & use a non-unicode font (like kiran.ttf - link) to display it. This sounds like too much of effort, not sure if this is a feasible solution (not tried it yet - kept as last option) or something else would also work?
Please let me know, your thoughts on the same.
(Note: This problem has nothing to do with what custom hindi font I use or is it ttf or otf.)
Thanks,
Shibbs
I have recently been through the same problem but unfortunately didn't find any solution. I agree that some of the text won't appear properly i.e. some of it may appear misplaced characters. If you try running it on device that is 3.0 or above (I am unsure of below 3.0), then you should be able to see it properly. Or try choosing en emulator with higher which has more than 4.0.

Categories

Resources