{"id":19420722,"url":"https://github.com/vincit/satakieli","last_synced_at":"2025-04-24T14:32:22.272Z","repository":{"id":62435093,"uuid":"114105764","full_name":"Vincit/satakieli","owner":"Vincit","description":"Satakieli is a i18n library that provides identical API for ClojureScript and Clojure programmers. Localized messages can be written using ICU MessageFormat syntax.","archived":false,"fork":false,"pushed_at":"2019-01-23T23:21:57.000Z","size":96,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-12T23:42:27.351Z","etag":null,"topics":["clojure","clojurescript","clojurescript-library","i18n","messageformat","translation"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vincit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-13T10:15:19.000Z","updated_at":"2024-06-27T18:28:56.000Z","dependencies_parsed_at":"2022-11-01T21:02:37.971Z","dependency_job_id":null,"html_url":"https://github.com/Vincit/satakieli","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vincit%2Fsatakieli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vincit%2Fsatakieli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vincit%2Fsatakieli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vincit%2Fsatakieli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vincit","download_url":"https://codeload.github.com/Vincit/satakieli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223956760,"owners_count":17231508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","clojurescript","clojurescript-library","i18n","messageformat","translation"],"created_at":"2024-11-10T13:24:52.442Z","updated_at":"2024-11-10T13:24:53.111Z","avatar_url":"https://github.com/Vincit.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Satakieli i18n library\n[![Clojars Project](https://img.shields.io/clojars/v/vincit/satakieli.svg)](https://clojars.org/vincit/satakieli)\n[![Build Status](https://travis-ci.org/Vincit/satakieli.svg?branch=master)](https://travis-ci.org/Vincit/satakieli)\n \n\n\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/9/98/Thrush_nightingale2_by_Daniel_Bastaja.jpg\" height=\"250\"\u003e\n\n(image: [Wikipedia](https://fi.wikipedia.org/wiki/Satakieli))\n\n\u003e A well a everybody's heard about the bird\n  B-b-b bird, bird, bird, b-bird's the word\n  A well a bird, bird, bird, the bird is the word\n  A well a bird, bird, bird, well the bird is the word\n  A well a bird, bird, bird, b-bird's the word...\n\n\\- The Trashmen\n\n## Overview\n\nThis project aims to provide unified Clojure((Script)) interface for ICU MessageFormat. This library wraps [icu4j](http://userguide.icu-project.org/formatparse/messages) when using Clojure and [messageformat.js](https://messageformat.github.io/) when using ClojuresScript.\n\nThis 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. \n## Usage\n\n```clj\n(require '[satakieli.compile :as c])\n(require '[satakieli.format :as f])\n\n(def translations\n  (c/compile-translations\n    {\"fi\" {\"hello\" \"Terve!\"\n           \"name\"  \"Minun nimi on {name}\"\n           \"time\"  \"Kello on {now, time}\"\n           \"candy\" \"Minulla {count, plural, =0 {ei ole karkkeja :(} =1 {on yksi karkki} other {on # karkkia}}\"\n           \"date\"  \"Tänään on {now, date}\"}\n     \"en\" {\"hello\" \"Hello!\"\n           \"name\"  \"My name is {name}\"\n           \"time\"  \"Current time is {now, time}\"\n           \"candy\" \"I have {count, plural, =0 {no candies :(} =1 {one candy} other {# candies}}\"\n           \"date\"  \"Today is {now, date}\"}}))\n\n(f/translate translations [\"fi\" \"hello\"])\n=\u003e \"Terve!\"\n(f/translate translations [\"en\" \"candy\"] {:count 1})\n=\u003e \"I have one candy\"\n(f/translate translations [\"en\" \"candy\"] {:count 0})\n=\u003e \"I have no candies :(\"\n(f/translate translations [\"en\" \"time\"] {:now (new java.util.Date)})\n=\u003e \"Current time is 8:57:33 AM\"\n```\n\n### Precompile formats using messageformat.js (requires node.js)\n\nInstall messageformat.js using node.\n```bash\nnpm install --save-dev messageformat\n```\nDefine translations in json files named \\\u003clocale\\\u003e.json ie. en.json (see examples/i18n).\n\nFrontend:\n```clj\n(ns satakieli.example.translations\n  (:require-macros [satakieli.messageformat.pre-compile :as pc]))\n  \n(pc/deformats translations \"examples/i18n\")\n```\nBackend:\n```clj\n(require '[satakieli.messageformat.load :as pc])\n\n(pc/deformats translations \"examples/i18n\")\n```\n\nThen use translations like above.\n\nMessageformat syntax:\nhttp://userguide.icu-project.org/formatparse/messages\n\n### Hot reload for translation json files using figwheel\n\nSee dev/user.clj how to create custom watcher for figwheel.\n\n## License\n\nCopyright © 2017 Vincit Oy\n\nDistributed under the Eclipse Public License either version 1.0 or (at your option) any later version.\n\n## messageformat.js license\n\nCopyright 2012-2016 Alex Sexton, Eemeli Aro, and Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincit%2Fsatakieli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvincit%2Fsatakieli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincit%2Fsatakieli/lists"}