For formatting time spans, you can use the LOCALE_SDURATION
format string, but the result is a dorky hh:mm:ss.ffff
format. Why isn’t there a LOCALE_SLONGDURATION
format that is fancier like hh hours, mm minutes, and ss.ffff seconds
?
You have the complexities of natural language to thank.
In the general case, there is not enough information to provide the appropriate grammatical context in order to know the correct format. This isn’t a big deal in English, since English words typically do not inflect for case (pronouns and genetive being the most commonly-encountered exceptions), but in many other languages, choosing the exact form of the word “hours” depends on grammatical information that cannot be captured in a simple call to GetLocaleInfo
.
For example, if you wanted to say “Last modified hh hours, mm minutes, and ss.ffff seconds ago”, the word “hours” would need one form, whereas if you had wanted to say “Active for hh hours, mm minutes, and ss.ffff seconds”, the word “hours” would need a different form. Some languages have quite a large number of grammatical cases (I’m looking at you, Finnish), and expressing all of this programmatically in a uniform way across all languages is impractical. The preposition since might take the accusative case in one language, but the genitive in another.¹
And we haven’t even gotten into the crazy world of singular/plural/dual/paucal, or whether zero is singular or plural.
The language folks may have realized that they didn’t want to dig themselves into a hole like they did with genitive months.
¹ And then there’s German, where some prepositions take multiple cases depending on context. Consider, for example, the preposition unter, meaning under.
Sentence | Case | Translation | Context |
---|---|---|---|
Wir laufen unter die Brücke. | Accusative | We run under the bridge. | We start outside the bridge, go under it, then |
Wir laufen unter der Brücke. | Dative | We run under the bridge. | We stay under the bridge the whole time. (It’s raining, so we are doing our running exercise under a bridge in order to stay dry.) |
I’ve internalized the rule for deciding which case to use, so much so that it’s hard for me to explain it, but I’ll try anyway. If the preposition applies throughout the entire activity, you use the dative. But if the point of the sentence is that situation changed from “not applicable” to “applicable” (in our example, from “not under” to “under”), then use the accusative. This is usually described in grammar books as change of position or motion toward a goal.
0 comments