vapor-community / lingo-vapor Goto Github PK
View Code? Open in Web Editor NEWVapor provider for Lingo - the Swift localization library
License: MIT License
Vapor provider for Lingo - the Swift localization library
License: MIT License
I'm making a custom tag for leaf and i cant figure out how get the requests current locale?
According to the RFC, locale identifiers in headers uses "-" to separate language from country code
https://httpwg.org/specs/rfc7231.html#header.accept-language
Therefore the code should be corrected to use "-"
Perhaps some logic from https://github.com/matsoftware/accept-language-parser can be used.
Hello!
Thanks for making this Package available. It is the only package I found that allows to Localize a Vapor app.
But there are missing things, that #6 and #7 are bringing, but they are still not merged (and even outdated; I tried to implement the suggested code into a project and it gave many errors)
Any possibility to get them patched and merged?
Is there an example/demo repo I could look at to see how this is implemented?
I dont understand how you title/specify the localization .json files, nor do I understand how the middleware interacts with that.
routes.get("hello-world") { req async throws -> String in
let lingo = try app.lingoVapor.lingo()
let localizedTitle = lingo.localize("title", locale: req.locale)
return localizedTitle
}
2022-06-05 21:52:49.648688-0400 Run[43028:3152906] Vapor/Request+Session.swift:17: Fatal error: No `SessionsMiddleware` detected.
Hello. I found error.
targets: [
.target(name: "App", dependencies: [
.product(name: "LingoVapor", package: "LingoVapor")
-----------------------------------------^^^^^^^^
package: "LingoVapor" need fix to package: "lingo-vapor"
Vapor 4.0
macOS 10.15.6
I set vapor's working dir manual.
app.directory = DirectoryConfiguration(workingDirectory: "/some/place/i/prefer")
and then
app.lingoVapor.configuration = .init(defaultLocale: "en")
Does it support custom working dir?
error":true,"reason":"Error Domain=NSCocoaErrorDomain Code=260 "The folder “Localizations” doesn’t exist."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.