All Projects → Vincit → Satakieli

Vincit / Satakieli

Licence: epl-1.0
Satakieli is a i18n library that provides identical API for ClojureScript and Clojure programmers. Localized messages can be written using ICU MessageFormat syntax.

Programming Languages

clojure
4091 projects
clojurescript
191 projects

Projects that are alternatives of or similar to Satakieli

Frenchkiss.js
The blazing fast lightweight internationalization (i18n) module for javascript
Stars: ✭ 776 (+3133.33%)
Mutual labels:  translation, i18n
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-29.17%)
Mutual labels:  translation, i18n
Ember Intl
Localization library for any Ember Application or Addon
Stars: ✭ 412 (+1616.67%)
Mutual labels:  translation, i18n
React Localize Redux
Dead simple localization for your React components
Stars: ✭ 384 (+1500%)
Mutual labels:  translation, i18n
I18next
i18next: learn once - translate everywhere
Stars: ✭ 5,971 (+24779.17%)
Mutual labels:  translation, i18n
Core
The internationalization (i18n) library for Angular
Stars: ✭ 4,027 (+16679.17%)
Mutual labels:  translation, i18n
Angular Translate
Translating your AngularJS 1.x apps
Stars: ✭ 4,414 (+18291.67%)
Mutual labels:  translation, i18n
Js Lingui
🌍📖 A readable, automated, and optimized (5 kb) internationalization for JavaScript
Stars: ✭ 3,249 (+13437.5%)
Mutual labels:  translation, i18n
Mobility
Pluggable Ruby translation framework
Stars: ✭ 644 (+2583.33%)
Mutual labels:  translation, i18n
Fluent.js
JavaScript implementation of Project Fluent
Stars: ✭ 622 (+2491.67%)
Mutual labels:  translation, i18n
I18n Manager
Translation management app
Stars: ✭ 373 (+1454.17%)
Mutual labels:  translation, i18n
React I18next
Internationalization for react done right. Using the i18next i18n ecosystem.
Stars: ✭ 6,942 (+28825%)
Mutual labels:  translation, i18n
Spree i18n
I18n translation files for Spree Commerce.
Stars: ✭ 338 (+1308.33%)
Mutual labels:  translation, i18n
Easy localization
Easy and Fast internationalizing your Flutter Apps
Stars: ✭ 407 (+1595.83%)
Mutual labels:  translation, i18n
Gotext
Go (Golang) GNU gettext utilities package
Stars: ✭ 292 (+1116.67%)
Mutual labels:  translation, i18n
Laravel Translation Loader
Store your translations in the database or other sources
Stars: ✭ 446 (+1758.33%)
Mutual labels:  translation, i18n
Tower
i18n & L10n library for Clojure/Script
Stars: ✭ 264 (+1000%)
Mutual labels:  translation, i18n
Eo Locale
🌏Internationalize js apps 👔Elegant lightweight library based on Internationalization API
Stars: ✭ 290 (+1108.33%)
Mutual labels:  translation, i18n
Gettext
PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
Stars: ✭ 578 (+2308.33%)
Mutual labels:  translation, i18n
Translation
The Translation component provides tools to internationalize your application.
Stars: ✭ 6,196 (+25716.67%)
Mutual labels:  translation, i18n

Satakieli i18n library

Clojars Project Build Status

(image: Wikipedia)

A well a everybody's heard about the bird B-b-b bird, bird, bird, b-bird's the word A well a bird, bird, bird, the bird is the word A well a bird, bird, bird, well the bird is the word A well a bird, bird, bird, b-bird's the word...

- The Trashmen

Overview

This project aims to provide unified Clojure((Script)) interface for ICU MessageFormat. This library wraps icu4j when using Clojure and messageformat.js when using ClojuresScript.

This library supports both run time compilation of messageformat strings and precompilation when using ClojureScript. Precompilation saves about 50kB of bundle size and speeds up execution.

Usage

(require '[satakieli.compile :as c])
(require '[satakieli.format :as f])

(def translations
  (c/compile-translations
    {"fi" {"hello" "Terve!"
           "name"  "Minun nimi on {name}"
           "time"  "Kello on {now, time}"
           "candy" "Minulla {count, plural, =0 {ei ole karkkeja :(} =1 {on yksi karkki} other {on # karkkia}}"
           "date"  "Tänään on {now, date}"}
     "en" {"hello" "Hello!"
           "name"  "My name is {name}"
           "time"  "Current time is {now, time}"
           "candy" "I have {count, plural, =0 {no candies :(} =1 {one candy} other {# candies}}"
           "date"  "Today is {now, date}"}}))

(f/translate translations ["fi" "hello"])
=> "Terve!"
(f/translate translations ["en" "candy"] {:count 1})
=> "I have one candy"
(f/translate translations ["en" "candy"] {:count 0})
=> "I have no candies :("
(f/translate translations ["en" "time"] {:now (new java.util.Date)})
=> "Current time is 8:57:33 AM"

Precompile formats using messageformat.js (requires node.js)

Install messageformat.js using node.

npm install --save-dev messageformat

Define translations in json files named <locale>.json ie. en.json (see examples/i18n).

Frontend:

(ns satakieli.example.translations
  (:require-macros [satakieli.messageformat.pre-compile :as pc]))
  
(pc/deformats translations "examples/i18n")

Backend:

(require '[satakieli.messageformat.load :as pc])

(pc/deformats translations "examples/i18n")

Then use translations like above.

Messageformat syntax: http://userguide.icu-project.org/formatparse/messages

Hot reload for translation json files using figwheel

See dev/user.clj how to create custom watcher for figwheel.

License

Copyright © 2017 Vincit Oy

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

messageformat.js license

Copyright 2012-2016 Alex Sexton, Eemeli Aro, and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].