Swift
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
Sources/NStack
Tests
.codebeatignore
.codecov.yml
.gitignore
.swiftlint.yml
LICENSE
Package.swift
README.md

README.md

NStack

Swift Version Vapor Version Circle CI codebeat badge codecov Readme Score GitHub license

This package is a wrapper around the NStack.io API.

Supports the following features:

  • Translate

📦 Installation

Update your Package.swift file.

.Package(url: "https://github.com/nodes-vapor/nstack.git", majorVersion: 2)

Config

Create config nstack.json

{
    "log": false,
    "defaultApplication": "appOne",
    "translate": {
        "defaultPlatform": "backend",
        "defaultLanguage": "en-UK",
        "cacheInMinutes": 60
    },
    "applications": [
        {
            "name": "appOne",
            "applicationId": "secret",
            "restKey": "secret",
            "masterKey": "secret"
        }
    ]
}

Make sure that client is set to foundation in droplet.json because the engine client does not properly support the required SSL connections.

  ...
  "client": "foundation",
  ...

Getting started 🚀

Config+Setup.swift

import NStack

And add provider

try addProvider(NStackProvider.self)

Usages

Consider making a easy accessible var

let translate = drop.nstack?.application.translate
// With default language and platform
translate?.get(section: "default", key: "ok")

// Specifying language and platform and replacing placeholders
translate?.get(platform: "backend", language: "en-UK", section: "default", key: "saveSuccess", replace: ["model": "test"])

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Rasmus.

📄 License

This package is open-sourced software licensed under the MIT license