What does the minus sign in indirect localized string resources mean?

The syntax for indirect localized string resources is @filename,-stringId, optionally followed by a semicolon and a comment. A customer wanted to know what the minus signs stands for.

The minus sign doesn't "stand for" anything. It's just part of the syntax. It's like asking what the semicolon at the end of a C statement stands for. It doesn't stand for anything; it's just part of the rules for C statements. (And if the minus sign has to stand for something, what does the comma stand for?)

Okay, so maybe the question was really "Why does the syntax for indirect localized strings include a minus sign? Isn't the comma enough?"

From a parsing standpoint, the comma is enough. The syntax for indirect strings was influenced by the syntax for icon locations, which also takes the form filename,number. We saw some time ago that the number after the comma can be positive or negative or zero. If positive or zero, it specifies the zero-based icon index. If negative, then it specifies the (negative of the) icon ID.

The indirect string syntax follows the same pattern, except that they don't support string indices. (As we saw earlier when we studied the format of string resources, a null string is indistinguishable from no string at all, which makes string indices largely meaningless since you can't tell whether a null string should be counted towards the index or not.) Since the only thing supported is IDs, and IDs are expressed as negative values, the first thing after the comma is always a minus sign.

Next time, we'll take a closer look at that comment field.

Comments (7)
  1. Windows tour guide says:

    It's like a flag. The @ stands for our land, the , stands for our history, and the – stands for defense against invaders.

    Don't ask how. They just do. Because I said so.

  2. So basically indirect-string:filename?index=123 vs. indirect-string:filename?id=456

  3. jon says:

    Icons don't use a @ in front of the filename. So it's not that the format for strings is the same as the one for icons, it's just that an implementation detail for icons that's meaningless for strings was for some reason used for strings. That's fine, but it seems a bit silly to pretend there's a good reason for it (unless it's just a way to get in a free sneer at the person asking the question).

    [The @-sign is there to distinguish the indirect string from a literal string. So it was not literally identical to the icon specification but was clearly intended to align with it. -Raymond]
  4. ender says:

    Since we're on topic of localization: will Windows ever learn to use plural forms in languages that use more than two of them? (Actually, does the current MUI format even allow for something like this?)

    [Old topic. I found this by searching for oldnewthing plural. -Raymond]
  5. ender says:

    I wish I was reading oldnewthing back in 2003.

    That entry does explain the weird phrasing I see all around the UI (the most common – "X items selected" in Slovenian is translated as "This number of items is selected: X" – and it sounds much worse in Slovenian). Such phrasing is really unusual in Slovenian, and stands out, which is why I was wondering if the support for plural forms can be added in a future version of Windows (I've also seen places where "X things" was used [in Slovenian], which was not the right plural form for X). A certain popular open-source localization framework has a working solution.

    BTW, that article mentions that Slovenian has dual – this is true, but we actually use 4 different forms depending on the number of items.

  6. Erzengel says:

    So what you're saying is that the minus sign stands for "use icon id rather than index", as semicolon in C++ stands for "end of statement" and comma stands for "end parameter with another parameter following".

  7. cheong00 says:

    Reading that old topic again, since I've read something about complex script from Micheal Kaplan's blog, I'd think the rotating rule should be governed by the fonts themselve instead of specific code of the toolbar. (I checked to see there's no such indicator in complex script specification, just suggesting it's possible to do so there)

Comments are closed.