Skip to content

kkiermasz/InternationalizedVapor

Repository files navigation

InternationalizedVapor

Internationalizes your Vapor's HTTP requests by wrapping the swift-foundation-icu.

Wrapper which provides NSFoundation-free Locale stands as a separate library.

Description

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.

Usage example

app.get("hello") { req in 
    let locale = try req.locale 
    return response
}

Locale negotiation examples can be found here.

Installation

Swift Package Manager

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")

License

InternationalizedVapor is shared under the MIT license. See both LICENSE and ICU4C's License for more info.

About

Internationalizes your Vapor's HTTP requests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages