Why is Android transliterating my Cyrillic language values to equivalent Latin values? - android

I have an issue with Serbian Cyrillic language in my app which have 14 different languages. Russian Cyrillic is working just fine.
For example, if user set the app to work in Serbian language, therefore strings.xml from values-sr should be read. And it does. However, output is in equivalent Latin script.
For example, in strings.xml there is a word:
<string name="Password"><DATA><![CDATA[Лозинка]]></DATA></string>
R.string.Password should display Лозинка but instead it is displaying transliterated word as Lozinka... all characters changed to Latin equivalents.
I have tried this on my Mate 20 Pro device. However, on Android simulator in all software versions is working just fine.
Any idea?

It's a bug specific to some Huawei models. If you set Serbian(Latin) as language in the phone settings, it transliterate all Cyrillic string resources to Latin. It also messes up other Cyrillic languages defined as string resources.

Related

Does getapplicationlabel returns non Latin characters?

Hi I want to pass installed Apps name to server for this I am using getApplicationLabel but server does not accept other than english character ,so I want to know whether getApplicationLabel (ApplicationInfo info) returns only English character or it may return non english character (like Chinese, hindi )?
No, it won't only return Latin characters.
There are at least two ways it won't.
If the app is only localized for a non-Latin alphabet, say some obscure Indian or Chinese app. The application probably isn't named using the basic Latin alphabet.
If the app is localized for many languages and the current device language is using a non-Latin script, such as Google Chrome. On a device with the language set to Chinese, getApplicationLabel() would likely return "谷歌浏览器".

What does the android resource qualifier -b stand for? [duplicate]

By default, Android has always displayed Serbian in Cyrillic, but since 7.0, users can choose between Cyrillic and Latin script. Apps (mostly from Google) ususally puts the Cyrillic strings in sr and the Latin strings in b+sr+Latn. However, b+sr+Latn is very different from the usual convention of using dashes (e.g. sr-rRS-port).
What does b stand for? What is the syntax, and what more can I specify with this?
It's a BCP 47 language tag. It's starts with b and followed by a language, script, region and variant.
BCP 47 documentation
b+sr+Latn would be Serbian with the Latin script.
b+sr+Latn+RS would be Serbian in Serbia, with the Latin script.
The same can be applied to Azerbaijani:
b+az+Latn – Latin script
b+az+Cyrl – Cyrillic script
b+az+Arab – Arabic script
But you can virtually do any combination possible:
b+ja+Hrkt – Japanese with only Hiragana and Katakana
b+ru+Latn – Russian with the Latin script
b+hu+Hung – Hungarian with the Hungarian Runic script
b+en+Cyrl+US – American English with the Cyrillic script
b+hy+Piqd+DE – German Armenian with the Klingon script
(but support will be very limited)
See also:
ISO 639-3 language list
ISO 15924 script list
ISO 3166-1 alpha-2 country list
The "b+" prefix was supported starting in Android 7.0. Prefixing "b+" to a language tag list tells Android that the remaining tags are BCP 47 language tags.
Other answers correctly mention this document, which defines those tags: https://tools.ietf.org/html/bcp47
However, the use of "b+" is not found in that document. The specific meaning behind "b+" is clarified in the Android docs:
To use a BCP 47 language tag, concatenate b+ and a two-letter ISO
639-1 language code, optionally followed by additional subtags
separated by +.
source: https://developer.android.com/guide/topics/resources/providing-resources
Other reference in code:
A BCP 47 language tag. The BCP-47 tag uses + instead of - as
separators, and has the prefix b+. Therefore, the BCP-47 tag
"zh-Hans-CN" would be written as "b+zh+Hans+CN" instead.
source:
https://android.googlesource.com/platform/tools/base/+/master/sdk-common/src/main/java/com/android/ide/common/resources/configuration/LocaleQualifier.java

What does b stand for, and what is the syntax behind b+sr+Latn?

By default, Android has always displayed Serbian in Cyrillic, but since 7.0, users can choose between Cyrillic and Latin script. Apps (mostly from Google) ususally puts the Cyrillic strings in sr and the Latin strings in b+sr+Latn. However, b+sr+Latn is very different from the usual convention of using dashes (e.g. sr-rRS-port).
What does b stand for? What is the syntax, and what more can I specify with this?
It's a BCP 47 language tag. It's starts with b and followed by a language, script, region and variant.
BCP 47 documentation
b+sr+Latn would be Serbian with the Latin script.
b+sr+Latn+RS would be Serbian in Serbia, with the Latin script.
The same can be applied to Azerbaijani:
b+az+Latn – Latin script
b+az+Cyrl – Cyrillic script
b+az+Arab – Arabic script
But you can virtually do any combination possible:
b+ja+Hrkt – Japanese with only Hiragana and Katakana
b+ru+Latn – Russian with the Latin script
b+hu+Hung – Hungarian with the Hungarian Runic script
b+en+Cyrl+US – American English with the Cyrillic script
b+hy+Piqd+DE – German Armenian with the Klingon script
(but support will be very limited)
See also:
ISO 639-3 language list
ISO 15924 script list
ISO 3166-1 alpha-2 country list
The "b+" prefix was supported starting in Android 7.0. Prefixing "b+" to a language tag list tells Android that the remaining tags are BCP 47 language tags.
Other answers correctly mention this document, which defines those tags: https://tools.ietf.org/html/bcp47
However, the use of "b+" is not found in that document. The specific meaning behind "b+" is clarified in the Android docs:
To use a BCP 47 language tag, concatenate b+ and a two-letter ISO
639-1 language code, optionally followed by additional subtags
separated by +.
source: https://developer.android.com/guide/topics/resources/providing-resources
Other reference in code:
A BCP 47 language tag. The BCP-47 tag uses + instead of - as
separators, and has the prefix b+. Therefore, the BCP-47 tag
"zh-Hans-CN" would be written as "b+zh+Hans+CN" instead.
source:
https://android.googlesource.com/platform/tools/base/+/master/sdk-common/src/main/java/com/android/ide/common/resources/configuration/LocaleQualifier.java

Writing in HINDI in android studio string.xml

I am trying to learn/build my first few apps on android using android studio. Apart from default language, I wanted to add support for HINDI language. I have created strings.xml file required for hindi and I have verified that whatever string I put in this file is displayed correctly when HINDI language is selected on Android device. To try this, I just wrote different sting in English characters, because I am unable to figure out how to write in HINDI in android studio.
For eg. I want something like this in my hindi strings.xml
<string name="customer_name">क्रुपया अपना नाम लिखे</string>
Currently I just have this in my XML:
<string name="customer_name">Please enter your name</string>
Could someone please provide on what should I do to type directly in hindi language in android studio xml?
You could use on-line Hindi editor like http://www.quillpad.in/editor.html and then copy paste your words in the android studio translation window.
Not sure whether this has been answerd already or not, but I did it by typing the words/phrases in Microsoft Word using Hindi keyboard, and then copy-pasted the text into Android Studio Translation Editor.
Not sure whether your problem is Hindi typing or Android Localization.
There are many options.
You can use a mobile keyboard.
You can use transliteration which is a word-level conversion from Roman to Hindi.
or Microsoft Indic tool which is a char level conversion to Devanagari chars.
There is no learning curve in using transliteration. Transliterators are provided by Google and Microsoft both.
Microsoft transliterator and indic tools both are available here.
https://www.microsoft.com/en-in/bhashaindia/downloads.aspx
By the way, the right spelling is कृपया not क्रुपया

What should be the values folder name for Serbian (Latin,Serbia) (sr-rs-latn) language?

I want to add Serbian Latin, Serbia language to my android app. However I am not able to figure out what should be name of values folder.
I tried values-sr-rRS-Latn but Android studio gave error.
I also referred to other thread with similar topic but it did not help.
What is the list of supported languages/locales on Android?
How to include 2 variants of Serbian Language? with Latin letters and with Cyrillic letters
Android localization values-** folder names
It should be values-b+sr+Latn
Source: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/libs/androidfw/Locale.cpp;l=213;drc=e0930d324c9c35546d6940e0ddc8f3e0bd850614
The name should be "values-sr"

Categories

Resources