I would like to ask is it possible to update/edit RTL languages with placeholders?
Other languages will correctly display the %1$s placeholder but in RTL languages is s$1%. Hence, it will crash if the placeholder will be replaced using
getString(R.string.sample, "mystring");
Is there any other way?
2
Answers
You can try concatenating the String, or appending substring to a StringBuilder.
Then
TextView.setText(<the result of concatenation>)
(Java) orTextView.text = <the result of concatenation>
(Kotlin).Yes, this is just a workaround, and even Android Studio tooltips doesn’t recommend it and will show a warning, because by doing so, it can’t handle locale changes if your app support multiple languages.
You can use it like this s$%1 for RTL languages.