ProductPromotion
Logo

Kotlin

made by https://0x3d.site

GitHub - formation-res/fluent-kotlin: Kotlin multi platdform localization for js and jvm based on project fluent
Kotlin multi platdform localization for js and jvm based on project fluent - formation-res/fluent-kotlin
Visit Site

GitHub - formation-res/fluent-kotlin: Kotlin multi platdform localization for js and jvm based on project fluent

GitHub - formation-res/fluent-kotlin: Kotlin multi platdform localization for js and jvm based on project fluent

Deploy to maven

Fluent-kotlin is a multi platform library for kotlin that provides message formatting for project fluent style localizations.

Instead of re-implementing this for platforms, this library simply adapts existing libraries for different platforms.

  • For javascript we use fluent.js
  • On the jvm we use xyzsd/fluent. This is a functional but not fully complete implementation; so your mileage may vary.

Fluent AI

Check out our new AI powered translation tool: Fluent AI. We wrote this tool to manage our project fluent translation tools. And of course it's a kotlin-js applications that uses fluent-kotlin for its translations. So, it serves as a nice example of how to use fluent-kotlin as well. You can dive into the source code here.

  • Edit language strings for different languages side by side
  • Easily identify missing translations and use AI to add the missing ones.
  • Add entire new languages with translations fully automatically
  • Sort and organize your translation strings and eliminate copy pasted identical translations

Gradle

Add the tryformation maven repository:

repositories {
    mavenCentral()
    maven("https://maven.tryformation.com/releases") {
        content {
            includeGroup("com.tryformation")
        }
    }
}

Then add the latest version:

implementation("com.tryformation:fluent-kotlin:0.1.2")

Note, check the release tags for the latest version.

Background

We use this library at FORMATION with our Fritz2 based ui as well as in our Spring Boot based server for sending e.g. localized emails.

When we were looking for a suitable localization solution, we came across Project Fluent. It currently has libraries for Javascript, Java and other languages. But since we are using Kotlin everywhere in our stack, we decided to abstract the behavior so we could share code, and translations between our client and server.

Usage

  • Define Translatable objects via e.g. an enum. This will allow you to use enums instead of string literals to identify your language strings.
  • Create some .ftl files with translations for different locales.
  • Instantiate LocalizedTranslationBundleSequenceProvider
  • Use a custom fetchFtl function to fetch your ftl source by locale id. If you e.g. put ftl files in resources you can fetch them using the browser fetch API (with kotlin-js) or by opening a classpath resource (kotlin-jvm).
  • Use it to load a LocalizedTranslationBundleSequence
  • Use that to format your Translatable identifiers.

Please refer to the unit tests for detailed examples. Also, check out our Full Stack Kotlin project, which integrates this library to add translations.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory