getQuantityString(id, quantity, formatArgs) not working for Korean strings

I have my plural strings setup as such:

    <plurals name="count_video">         <item quantity="other">%동영상 %d개</item>     </plurals>     <plurals name="count_photo">         <item quantity="other">%사진 %d개</item>     </plurals> 

And I’m getting the following exception message:

java.util.UnknownFormatConversionException: Conversion = '사'         at java.util.Formatter$FormatSpecifier.conversion(         at java.util.Formatter$FormatSpecifier.<init>(         at java.util.Formatter$FormatSpecifierParser.<init>(         at java.util.Formatter.parse(         at java.util.Formatter.format(         at java.util.Formatter.format(         at java.lang.String.format( 

I’ve tried replacing my %d with %s but nothing seems to work. I’m curious if this is a bug with Android or if I’m missing something.

Any advice is appreciated, thanks.

Add Comment
1 Answer(s)

(Caveat: I have absolutely no knowledge of Korean, so this is just what I can see as an English speaker.)

The start of count_photo‘s item is "%사". The same system that tries to parse %d or %s sees this combination and believes it to be a format specifier. I’m assuming that you just want the "%" character to appear in your string; this is achieved by doubling the % in your string.

<plurals name="count_video">     <item quantity="other">%%동영상 %d개</item> </plurals> <plurals name="count_photo">     <item quantity="other">%%사진 %d개</item> </plurals> 
Answered on July 15, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.