Support for Koa
See original GitHub issueKoa is a new framework using ES6 generator, by the creators of Express. There is however a small change in the api of middleware compared to Express. Instead of having Request
and Responses
objects, they’re using the this
object, with similar data on the object. So the i18n.init
middleware won’t work.
I wanted to write my own middleware, however the guessLanguage
& applyAPItoObject
functions are private, so it’s rather difficult. I was wondering if Koa support is planned, or if maybe both those functions could be exposed so that I could write some middleware for Koa.
Issue Analytics
- State:
- Created 10 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Contact KOA | KOA FAQ | Frequently Asked Questions
Contact the KOA Corporate Office. Contact Us Online. Customer Service: 1-888-562-0000. Please note: KOA Campgrounds are franchised and handle all of the day ......
Read more >Do I receive a card? - KOA
Help : Frequently Asked Questions. Do I receive a card? KOA Campgrounds do not need a printed copy of your account. All KOAs ......
Read more >Camping Loyalty Program & Discounts With KOA Rewards
So no more searching for the best RV campground membership or loyalty program, purchase or renew rewards with KOA today and start earning...
Read more >KOA Care Camps Trust | Helping Kids With Cancer
KOA Care Camps is the official charity of the KOA Owners Association and offers camping experiences for children battling cancer. Learn more today....
Read more >Feedback - KOA
We use cookies on koa.com to help improve your experience by remembering your preferences and repeat visits, troubleshoot how the site operates, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone interested, @crocodilejs uses this package in the framework (which is Koa@next + ES7) https://github.com/crocodilejs/crocodile-node-mvc-framework, but written with some cool glue on top. I didn’t want to fork this because there are so many other i18n packages out there to confuse people with. But maybe I should?
Here’s the code for anyone interested:
https://github.com/crocodilejs/crocodile-node-mvc-framework/blob/294407e84a0d9c4377d0f9fe237b2a7278c6a028/src/helpers/i18n.js
Basically you do
app.use(i18n.middleware);
first, and then follow it withapp.use(i18n.redirect);
second. The latter is for locale support in URL’s though (it redirects from/
to/en
by default, or if you have/foo/bar
it will redirect to the locale/en/foo/bar
for example. CrocodileJS is set up for you automatically to handle this.If anyone ends up looking into this, I recommend you join us in Slack for more discussion and insight into what we’re doing with CrocodileJS! http://slack.crocodilejs.com
Some screenshots of what we’re doing using this package below…
cc @mashpie 👍 thank you for making this ❤️ ✨ 🦄
😃