PolymerElements / app-localize-behavior

Polymer behaviour to help internationalize your application
48 stars 55 forks source link

implement negotiateLanguage() #109

Closed jab closed 7 years ago

jab commented 7 years ago

Hey Polymer team!

My team at Jigsaw is starting to make use of AppLocalizeBehavior in a few of our Polymer apps, and I found myself wondering if this code might more properly belong right in AppLocalizeBehavior itself. I thought I'd sketch out a quick PR in case this functionality could be a common need for other users of AppLocalizeBehavior – if so I'd be more than happy to add more docs, tests, and make any other required changes, and if not, sorry for the noise 😇

Thanks for all the great work on Polymer! Y'all are on 🔥! Cheering you on from here ❤️❤️❤️

jab commented 7 years ago

So after looking at a few more resources (https://tools.ietf.org/html/rfc4647#section-3.4, https://tools.ietf.org/html/rfc5646#appendix-A, etc.) and considering further, I get the feeling that baking a 90% solution like this right into this element may not be the right way to go. Better to leave logic like this up to a separate element that can just focus on implementing 100% of the specs. So I'll close this in favor of that.

I unfortunately can't immediately find any generic libraries that implement this functionality for the browser environment (only stuff for server-side environments or framework-specific (e.g. angular) stuff is turning up so far), so for now I just moved this 90% solution into a tiny bower package and am pointing to that. If anyone knows of something better, any recommendations would be very interesting!