-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
India national expressway shield #676
Conversation
src/js/shield_defs.js
Outdated
@@ -3385,6 +3385,10 @@ export function loadShields(shieldImages) { | |||
bottom: 7, | |||
}, | |||
}; | |||
shields["IN:NE"] = { | |||
...shields["IN:NH"], | |||
numberingSystem: "roman", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This touches on #465, but I think the NE shields are different than the other cases in that issue. It seems to be common to refer to the expressways by European numerals in writing, but shields or the gantry name signs mentioned in #225 (comment) mostly use Roman numerals. (I’ve come across photos of a few signs that use European numerals, but only as part of an entrance portal.)
let roman = | ||
"M".repeat(number / 1000) + | ||
"D".repeat((number % 1000) / 500) + | ||
"C".repeat((number % 500) / 100) + | ||
"L".repeat((number % 100) / 50) + | ||
"X".repeat((number % 50) / 10) + | ||
"V".repeat((number % 10) / 5) + | ||
"I".repeat(number % 5); | ||
roman = roman | ||
.replace("DCCCC", "CM") | ||
.replace("CCCC", "CD") | ||
.replace("LXXXX", "XC") | ||
.replace("XXXX", "XL") | ||
.replace("VIIII", "IX") | ||
.replace("IIII", "IV"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are NPM packages for converting to Roman numerals, which we could use instead of rolling our own. Either way, I’m thinking of this as a temporary polyfill until more browsers support numbering systems in Intl.NumberFormat
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ref
has an Arabic number, but the IRL sign has a roman numeral??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s correct: #676 (comment). I’m asking for confirmation in the India Telegram chat, but so far it seems like the shield is the only context in which someone would use Roman numerals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere we discussed countries that use Eastern Arabic Script numerals in their highway shields and I thought the expectation was that the "as shown on the sign" value is what would go in the ref
tag. I'm wondering if we're doing the right thing for mapper feedback by doing the roman numeral conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That discussion started in #465 and continued in #467 (comment). But I think the national expressways pose a different sort of challenge. If it turns out that “II” should only appear in a shield, while “2” should appear in text, then we’d be doing a disservice to non-renderers by encouraging mappers to essentially put ASCII art into ref
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going back to the subject of this thread, any opinion on pulling in a dependency versus relying on this homegrown implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I'd defer to people that know how to program on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this implementation is okay until we can use Intl.NumberFormat
. Fingers crossed that it won't be long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Ideally we wouldn't need our own function to convert number formats, but I think this is okay as a proof of concept.
Added a function to convert European numerals to Roman numerals, which are the distinguishing feature of this shield.
I'm looking for a test location, in order to confirm that this still works in #714. |
I always link my screenshots to test locations. 🙂 |
Ohhhh |
Added an India national expressway shield mostly identical to the national highway shield. Added a function to convert European numerals to Roman numerals, which are the distinguishing visual element of this shield.
Working towards #225.