Internationalizes your Vapor's HTTP requests by wrapping the swift-foundation-icu.
Wrapper which provides NSFoundation
-free Locale
stands as a separate library.
For example, a browser sends the web server the HTTP Accept-Language
header indicating which locales, with a ranking, are acceptable to the user.
The server must determine which locale to use when returning content to the user.
The negotiation result for ja;q=0.5, en-us;q=0.8, tlh
will be en_US
.
app.get("hello") { req in
let locale = try req.locale
return response
}
Locale negotiation examples can be found here.
Use Swift Package Manager by adding below dependency to your Package.swift
file:
.package(url: "https://github.com/kkiermasz/InternationalizedVapor.git", from: "1.1.0")
InternationalizedVapor is shared under the MIT license. See both LICENSE and ICU4C's License for more info.