[WIP] Moved over to use NSLocale#5
Conversation
|
Hahaha, you gotta be kidding me. 😂
Me, yesterday. 🙈 I had just started a PR for this yesterday evening, too, but then got distracted. |
|
Hey Marius, wow, great work! Thank you. This is indeed way more elegant and makes the whole thing more concise and readable. A few thoughts: (1) Is it correct that this change will require iOS 10? I saw that this info also exists in Core Foundation’s (2) For Swiss German (de_CH), the quotations marks are not correct in (3) French needs (4) On the unit tests: I think the current solution is rather repetitive and—especially as soon as we use NSLocale—we don’t need to test every language specifically if the test string remains the same. Language-specific testing would make much more sense for long texts that are actually written in the language at hand. Plus, I think it would be great feed the test with a long, tricky text with all the edge cases that Typographizer can already handle correctly, instead of testing the current—rather simple—string that only triggers the easiest replacement situations. 🤔 |
This is indeed the case. While
Fair point. One might want to at least open a tracking issue for it then, for future reference. Preferably with a note explaining why the change is to be considered blocked for now.
Absolutely.
Interesting, so in theory one might want to also check valid french smart quotes for the existence of those additional spaces.
Yes. I added the tests in preparation for my PR which would have been equivalent to this one. We would probably want to have a single test for the general case and then at least one for each custom override (see discussion above).
Absolutely. Tests would shine for edge-casy stuff like Btw, @mRs- you can wrap long snippets in |
|
Maybe we should file a radar with the right quotation delimiters to apple to be fixed in iOS 11 or later. |
|
Yes, filing a radar about the quote style makes sense. I’ll try to find out what the preferred variants in Maybe I should drop your NSLocale-generated list at the next Typostammtisch event in Berlin and typenerd-crowdsource the process. |
|
That sounds great! And would be the right approach to do this. If we are already using NSLocale and Apple is defining a way to support this everyone can profit about this. Maybe this can be Implemented right away in the Apple System for using the right qutoation styles :) |
|
@frankrausch for |
I studied a little bit in the newest NSLocale features from iOS 10 and found that there are four new properties on NSLocale.
quotationBeginDelimiterquotationEndDelimiteralternateQuotationBeginDelimiteralternateQuotationEndDelimiterMy first approach was to eliminate the string best guessing stuff in the API Design to move over to a struct. Then I found out that we can do better and maybe use Apples API to get the locales.
But the Unit-Tests are not on my side. I don't know anything about quotation marks so I created a list of all possibilities that you can check if it's really the right ones that we are getting back from Apple. When we find out, that's not the right one maybe we should file some bug reports to support this in the future of NSLocale :)
If you want to generate the list on your own just drop the line of codes in a playground