Swiftpack.co - Package - nodes-vapor/nstack

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

Github

link
Stars: 5
Help us keep the lights on

Releases

2.0.1 - Jan 24, 2018

  • Fixes runtime crash by postponing resolving of the client

2.0.0 - Jan 22, 2018

  • remove dependency on Droplet
  • fix type in ConnectionManager class + file

1.0.0 - May 18, 2017

  • Vapor 2 released 🎉

1.0.0-beta.1 - Apr 27, 2017

  • Ready for Vapor 2

0.1.2 - Feb 21, 2017

  • Fixed a bug with isOutdated function on translate cache