I did this reabstraction to make it easier to match/compare langs. For instance, Lang.English() should match en but also all en-*. But it's still highly experimental since I'm not very opinionated on how i18n should work. I'll revisit this system when I want to play with real world i18n impl's since that will be the real test of flexibility, and I know the current system isn't there yet.
Trying to get rid of content-type string-typing, and trying to unify/canonicalize all instances of mimes in kog. Probably went too far, but won't be able to see where/why I need to reabstract until I upgrade one of my kog apps that uses content-type more extensively.
Not so convinced that having strings here is all that bad. But I do hate typing out "application/x-www-form-urlencoded" when I have to.
Another issue is that the user can potentially use both res.setHeader(Header.ContentType, "text/html") and res.contentType = ContentType(Mime.Html), but right now I make the res.contentType overwrite the content-type header.
One thing you can do now with the new ContentType(mime, params) abstraction is add a charset=uft-8 and potentially other params (how many are actually used? I can only think of multipart boundary ><). Previously you could not.
TODO: This should go in the wiki but I've disabled the wiki for now.
A list of git commits that I think will be useful to future me, like large refactorings that I would like to revisit in the future.
https://github.com/danneu/kog/commit/7429b6b79699a52a295f2603969d764de7845701 Reabstracting the accept-language Lang and Locale system.
I did this reabstraction to make it easier to match/compare langs. For instance,
Lang.English()
should matchen
but also allen-*
. But it's still highly experimental since I'm not very opinionated on how i18n should work. I'll revisit this system when I want to play with real world i18n impl's since that will be the real test of flexibility, and I know the current system isn't there yet.[14 July] https://github.com/danneu/kog/commit/f235a63fb8568fc362aa28e0d358894ead053ede Created
ContentType(Mime, params)
abstraction.Trying to get rid of content-type string-typing, and trying to unify/canonicalize all instances of mimes in kog. Probably went too far, but won't be able to see where/why I need to reabstract until I upgrade one of my kog apps that uses content-type more extensively.
Not so convinced that having strings here is all that bad. But I do hate typing out
"application/x-www-form-urlencoded"
when I have to.Another issue is that the user can potentially use both
res.setHeader(Header.ContentType, "text/html")
andres.contentType = ContentType(Mime.Html)
, but right now I make theres.contentType
overwrite the content-type header.One thing you can do now with the new
ContentType(mime, params)
abstraction is add acharset=uft-8
and potentially other params (how many are actually used? I can only think of multipart boundary ><). Previously you could not.