Swiftpack.co -  vapor-community/Lingo-Vapor as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Vapor provider for Lingo - the Swift localization library
.package(url: "https://github.com/vapor-community/Lingo-Vapor.git", from: "4.1.0")

Lingo Provider

Language GitHub license

A Vapor provider for Lingo - a pure Swift localization library ready to be used in Server Side Swift projects.


Add a dependancy

Add LingoProvider as a dependancy in your Package.swift file:

dependencies: [
	.package(name: "LingoVapor", url: "https://github.com/vapor-community/lingo-vapor.git", from: "4.0.0")]
targets: [
    .target(name: "App", dependencies: [
        .product(name: "LingoVapor", package: "LingoVapor")

Add the Provider

In the configure.swift simply initialize the LingoVapor with a default locale:

import LingoVapor
public func configure(_ app: Application) throws {
	app.lingoVapor.configuration = .init(defaultLocale: "en", localizationsDir: "Localizations")

The localizationsDir can be omitted, as the Localizations is also the default path. Note that this folder should exist under the workDir.


After you have configured the provider, you can use lingoVapor service to create Lingo:

let lingo = try app.lingoVapor.lingo()
let localizedTitle = lingo.localize("welcome.title", locale: "en")

Use the following syntax for defining localizations in a JSON file:

	"title": "Hello Swift!",
	"greeting.message": "Hi %{full-name}!",
	"unread.messages": {
		"one": "You have one unread message.",
		"other": "You have %{count} unread messages."

Learn more

  • Lingo - learn more about the localization file format, pluralization support, and see how you can get the most out of the Lingo.


Stars: 39
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Locale fallbacks
4 weeks ago
  • Fall back to language code when localization file matching both language code and country code can not be found (for example en_US would fall back to en if en_US doesn't exist)
  • Fall back to language code in pluralization rules lookup

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