Swiftpack.co - kkiermasz/InternationalizedVapor as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by kkiermasz.
kkiermasz/InternationalizedVapor v1.1.0
Internationalizes your Vapor's HTTP requests
⭐️ 4
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/kkiermasz/InternationalizedVapor.git", from: "v1.1.0")

InternationalizedVapor

Internationalizes your Vapor's HTTP requests by wrapping Unciode's ICU4C.

ICU4C's wrapper which provides Foundation-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.

GitHub

link
Stars: 4
Last commit: 6 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v1.1.0
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics