Android resource strings.xml - Arabic and dynamic formatted strings

Hello, I have a question about Arabic formatting, how to format these lines correctly, it seems I can not do this:

ุชุญู…ูŠู„ %1$s… ุชู… ุชุญู…ูŠู„ ุงู„ูƒู„ู…ุงุช. %1$d/%2$d! 

This is in sublime text 2 - but I think there is order from left to right

enter image description here

Editorial: In Eclipse, this copied from Sublime Text is a bit confused. I am hiring someone to translate english to arabic strings.xml. He used the Word editor, but everything got messy when you dealt with the eclipse, and I suggested changing it in Sublime Text, which, I think, will support it correctly, as in Eclipse, and is a lighter editor. I see that in Sublime Text, it seems to be in order from left to right, which is also not true. * When I launch the application with these confused special characters, it works correctly. Boo, I doubt that some of the words of the interpolation also did not go bad and, for example: point 5/10 is loaded. The item will be uploaded. 5/10 or something like that. * Need a preferred way to get someone written in English strings.xml, get that translated, and then copy to / values โ€‹โ€‹-ar and work correctly? enter image description here

+5
source share
4 answers

Try adding the RIGHT-TO-LEFT MARK character (\ u200F) at the beginning of your text.

similar type answered here

+5
source

This is an exalted issue with the Right-Left languages โ€‹โ€‹listed here . You do not need to worry too much about it, because it does not affect the results, your application will show it perfectly.

+3
source

You should use Arabic Font as:

 Typeface face = Typeface.createFromAsset(this.getAssets(), "fonts/arabic_letters.TTF"); yourTextView = (TextView) findViewById(R.id.yourTextVIew); yourTextView.setTypeface(face, Typeface.BOLD); 
+1
source

"To solve this problem, use the unicodeWrap () method found in the BidiFormatter class for each piece of text that you insert in a localized message."

Quote from here https://developer.android.com/training/basics/supporting-devices/languages.html#FormatText

0
source

Source: https://habr.com/ru/post/1215426/


All Articles