nate-parrott / Flashlight

The missing Spotlight plugin system
http://flashlight.nateparrott.com
Other
5.39k stars 411 forks source link

Country Exceptions #185

Closed xremix closed 9 years ago

xremix commented 9 years ago

I'd have an idea for exceptions. There are many plugins that are specific for one country or language (like Chinese websites, translators or german sites). The developer could specify exceptions so they only show for specific locales. Of course a Chinese translator could be interesting in China but other countries as well!

So what does everybody think about this?

nate-parrott commented 9 years ago

This makes sense — is there a way to accurately get the user's current country in os x (besides IP address)? On Tue, Dec 9, 2014 at 1:08 PM xremix notifications@github.com wrote:

I'd have an idea for exceptions. There are many plugins that are specific for one country or language (like Chinese websites, translators or german sites). The developer could specify exceptions so they only show for specific locales. Of course a Chinese translator could be interesting in China but other countries as well!

So what does everybody think about this?

— Reply to this email directly or view it on GitHub https://github.com/nate-parrott/Flashlight/issues/185.

xremix commented 9 years ago

I am just aware of the locale:

 NSLocale *locale = [NSLocale currentLocale]; 
 [locale objectForKey:NSLocaleLanguageCode]
achterberg commented 9 years ago

I hope this is relevant: Keep in mind users will have their system language set to their preferences, not regarding to which country they are in or the IP address.

nate-parrott commented 9 years ago

Yep. There's also the question of people who might be in a particular country but still want to use a country-specific site from somewhere else. Hiding all plugins that aren't in your current language seems too extreme — what's a better solution?

On Tue, Dec 9, 2014 at 3:03 PM, David Achterberg notifications@github.com wrote:

I hope this is relevant: Keep in mind users will have their system language set to their preferences, not regarding to which country they are in or the IP address.

— Reply to this email directly or view it on GitHub https://github.com/nate-parrott/Flashlight/issues/185#issuecomment-66347774 .

xremix commented 9 years ago

True...

I thought about something like a setting like:

...
 include_in_countries: ['us', 'gb'],
...

This would only show it in these countries.

...
 exclude_in_countries: ['ch', 'at', 'de'],
...

This would only exclude it for these countries and show it in all countries. Then you could simply check if the current country is in one of these arrays.

nate-parrott commented 9 years ago

Hmm — I'm not sure what the use case of exclude_in_countries would be, but include_in_countries makes sense.

Rather than completely hide plugins from non-matching locales, how about just showing them at the bottom of the list (maybe in a smaller font), under a "plugins in other languages" header or something?

xremix commented 9 years ago

That would only make sense if somebody would show it in every country except one... but I can't think of any reason (except legal, or politics)

nate-parrott commented 9 years ago

yep — I think I'll add a preferred_locales field, and show plugins that have preferred_locales that don't match the user's current locale at the bottom of directory pages.

xremix commented 9 years ago

Sounds good. So what about if a plugin has a preferred locale it could show up promoted on top or maybe in a category, and if they have a preferred locale and don't match they show up on bottom

nate-parrott commented 9 years ago

Done. There's an optional preferred_locales field in info.json. If it's set, and none of the preferred locales match your system locales, the plugin is shown at the bottom of the listing.

I've only added it to one plugin — haomatong — for testing, but people are welcome to start adding this tag to existing plugins.