Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 1.82 KB

README.md

File metadata and controls

71 lines (46 loc) · 1.82 KB

messagevisor-example-kotlin

A small Kotlin/JVM application using the published Messagevisor Java SDK.

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

Learn more at messagevisor.com.

Requirements

  • JDK 17 or newer
  • A GitHub account and token with the read:packages scope

GitHub Packages authentication

Messagevisor Java is published through GitHub Packages. Add your GitHub username and personal access token to ~/.gradle/gradle.properties:

gpr.user=YOUR_GITHUB_USERNAME
gpr.key=YOUR_GITHUB_TOKEN

Keep these credentials outside the repository. For GitHub Actions, grant the example repository read access to the Messagevisor Java packages.

Build and test

make build

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:

./gradlew run --args="https://example.com/messagevisor-web-en-US.json"

The example uses:

  • com.messagevisor:messagevisor-sdk:0.2.0
  • com.messagevisor:messagevisor-module-icu:0.2.0

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 Java runtime.

License

MIT