donatj / PhpUserAgent

Lightning Fast, Minimalist PHP User Agent String Parser.
https://donatstudios.com/PHP-Parser-HTTP_USER_AGENT
MIT License
565 stars 128 forks source link

Rename Macintosh to Mac #58

Closed nickdnk closed 4 years ago

nickdnk commented 4 years ago

Hello

Could we perhaps rename the Macintosh platform to simply Mac? It hasn't been branded as Macintosh since 1998, and I'd like to avoid having to "translate" this to Mac for newer users that simply don't know what a Macintosh is.

donatj commented 4 years ago

They refer to themselves as Macintosh in the string they send. Translating that on my end would be wrong.

For example the newest Safari refers to itself as:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15

Additionally it would be a large breaking change for users who have coded around the value.

nickdnk commented 4 years ago

Isn't the entire point of this library to translate the User-Agent string into what the platform/browser actually is? The newest Windows also "calls itself" Windows NT, even though that's also a legacy term and not used anymore; like you call it just Windows in this library. That's kind of the same thing as with Macintosh.

But I'll just fork it then.

donatj commented 4 years ago

Isn't the entire point of this library to translate the User-Agent string into what the platform/browser actually is?

Explicitly Nope ;)

From, the README

This is not meant as a browser "knowledge engine" but rather a simple parser.

I try to do as little translation/manipulation of what is sent as possible. My goal is just to parse it into its pieces.

donatj commented 4 years ago

Also you'd probably be happier just writing a wrapper as opposed to forking as it'd be simpler for you to keep up to date. I've got a major rewrite coming in the next couple months.

nickdnk commented 4 years ago

I get that you don't want to add or maintain a database of "what is what", and I am not asking you to. I was simply suggesting that you call the platform by the name it's known for. If you are doing a major rewrite with BC and all, that seems like the perfect opportunity. I don't think anyone is going to be mad or confused that suddenly the identified platform has the name it's been branded under for the last 20 years. And if you can change Windows NT (which is a family as well, not a version: https://en.wikipedia.org/wiki/Windows_NT) into simply Windows as people know it, then Macintosh into Mac doesn't seem all that crazy to me.

I wasn't trying to be annoying. I thought this was a genuine improvement and it was the only thing about the library that I didn't like (that and perhaps that the function isn't a static class call or something). Everything else is really nice and fast.