Open barbeau opened 9 years ago
This also applies to the notification for real-time info:
@barbeau we already have this, including values in strings. The problem is that negative values are changed later on (in the special cases of delays), and only positive one is substituted, I'll add it also for -1. I prefer to not change all negative values because I think that it's more clear this way and to don't hide some possible errors.
I'll submit a correction with this and other graphical improvements to the notifications in a few minutes.
Thanks @vreixo, for fixing the -1 presentation! I'm going to re-open the issue, so at some point in the future we can use the official Android plurals technique to format singular/plural strings. The reason behind wanting to use this is that different languages have different ways to represent singular/plural, so its better to use the built-in Android rules for this. From the above link:
Different languages have different rules for grammatical agreement with quantity. In English, for example, the quantity 1 is a special case. We write "1 book", but for any other quantity we'd write "n books". This distinction between singular and plural is very common, but other languages make finer distinctions. The full set supported by Android is zero, one, two, few, many, and other.
The rules for deciding which case to use for a given language and quantity can be very complex, so Android provides you with methods such as getQuantityString() to select the appropriate resource for you.
@barbeau agreed that mechanism seems very interesting. Regarding my previous comment, I was just referring to don't change all negative values in our function of the app.
As discussed in https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/issues/413#issuecomment-55166727, we should use plurals for singular (
minute
) vs. plural (minutes
) text displayed to the user.Good examples of implementation for this are in the OBA Android project:
Usage in code is shown here: