strongloop / strong-globalize

strong-globalize is built on Unicode CLDR and jquery/globalize and implements automatic extraction of strings from JS source code and HTML templates, lint the string resource, machine-translate them in seconds. In runtime, it loads locale and string resource into memory and provides a hook to persistent logging.
Other
25 stars 16 forks source link

Add Accept-Language negotiation #125

Closed mamendoz closed 6 years ago

mamendoz commented 6 years ago

This is useful to integrate the library with express apps.

Thie change makes it so that strong globalize chooses the best matching language based on the Accept-Language header of an HTTP request.

This change also modifies the string extraction logic so that it will look in the source code for expressions like g.http(req).f(...)

slnode commented 6 years ago

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

raymondfeng commented 6 years ago

@mamendoz Great contribution! I added a minor comment.

raymondfeng commented 6 years ago

@rmg I'm good with the PR. Feel free to merge and release it once you finish the review.

raymondfeng commented 6 years ago

The build is broken now: https://travis-ci.org/strongloop/strong-globalize/builds/348517088?utm_source=github_status&utm_medium=notification

rmg commented 6 years ago

@mamendoz can you add at least a test that does language negotiation so we have some confidence that it is actually doing what it should be instead of just always defaulting to en?

rmg commented 6 years ago

@slnode ok to test