Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.62 KB

README.md

File metadata and controls

63 lines (40 loc) · 1.62 KB

messagevisor-example-swift

A small Swift application using the published Messagevisor Swift SDK.

It fetches a production datafile from the Messagevisor Cloudflare Pages example, creates a Messagevisor instance, and evaluates plain and ICU formatted translations.

Learn more at messagevisor.com.

Requirements

  • macOS 13 or newer
  • Swift 5.9 or newer

Build and test

make build

This resolves the package dependency, compiles the application, and runs its unit test.

Run

make run

The application fetches this datafile by default:

https://messagevisor-example-cloudflare-pages.pages.dev/production/messagevisor-web-en-US.json

You can provide another Messagevisor datafile URL as the first argument:

swift run messagevisor-example-swift https://example.com/messagevisor-web-en-US.json

The example uses Messagevisor Swift 0.1.0 and its ICU module.

Example output

Datafile: https://messagevisor-example-cloudflare-pages.pages.dev/production/messagevisor-web-en-US.json
Locale: en-US
Target: web
Revision: 2

auth.signin: Sign in
nav.home: Home
nav.contact: Contact us before 5:30 PM

The exact localized time output can differ slightly with the CLDR data provided by the installed Apple runtime.

Related project

The served datafile is authored and deployed by messagevisor-example-cloudflare-pages.

License

MIT