[Git][clojure-team/puppetlabs-i18n-clojure][upstream] New upstream version 1.0.4
Thomas Goirand (@zigo)
gitlab at salsa.debian.org
Sat Jul 18 19:34:09 BST 2026
Thomas Goirand pushed to branch upstream at Debian Clojure Maintainers / puppetlabs-i18n-clojure
Commits:
dfe3798f by Thomas Goirand at 2026-07-18T20:19:43+02:00
New upstream version 1.0.4
- - - - -
15 changed files:
- + .github/dependabot.yml
- + .github/release.yml
- + .github/workflows/pr-testing.yaml
- + .github/workflows/release.yaml
- − .travis.yml
- − CODEOWNERS
- README.md
- example/program/project.clj
- − ext/travisci/test.sh
- project.clj
- + renovate.json
- src/leiningen/i18n.clj
- src/puppetlabs/i18n/core.clj
- test/puppetlabs/i18n/bin_test.clj
- test/puppetlabs/i18n/core_test.clj
Changes:
=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,17 @@
+version: 2
+updates:
+ # raise PRs for gem updates
+ - package-ecosystem: bundler
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "13:00"
+ open-pull-requests-limit: 10
+
+ # Maintain dependencies for GitHub Actions
+ - package-ecosystem: github-actions
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "13:00"
+ open-pull-requests-limit: 10
=====================================
.github/release.yml
=====================================
@@ -0,0 +1,39 @@
+---
+# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
+
+changelog:
+ exclude:
+ labels:
+ - duplicate
+ - invalid
+ - modulesync
+ - question
+ - skip-changelog
+ - wont-fix
+ - wontfix
+
+ categories:
+ - title: Breaking Changes 🛠
+ labels:
+ - backwards-incompatible
+
+ - title: New Features 🎉
+ labels:
+ - enhancement
+
+ - title: Bug Fixes 🐛
+ labels:
+ - bug
+
+ - title: Documentation Updates 📚
+ labels:
+ - documentation
+ - docs
+
+ - title: Dependency Updates ⬆️
+ labels:
+ - dependencies
+
+ - title: Other Changes
+ labels:
+ - "*"
=====================================
.github/workflows/pr-testing.yaml
=====================================
@@ -0,0 +1,68 @@
+---
+name: lein_test
+
+on:
+ pull_request: {}
+ push:
+ branches:
+ - main
+
+# minimal permissions
+permissions:
+ contents: read
+
+jobs:
+ run-lein-tests:
+ name: lein test - Java ${{ matrix.java }}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ java:
+ - '25'
+ - '21'
+ - '17'
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout at v6
+ - name: Setup java
+ uses: actions/setup-java at v5
+ with:
+ distribution: temurin
+ java-version: ${{ matrix.java }}
+ - name: Install Clojure tools
+ uses: DeLaGuardo/setup-clojure at 13.5
+ with:
+ cli: latest # Clojure CLI based on tools.deps
+ lein: latest # Leiningen
+ boot: latest # Boot.clj
+ bb: latest # Babashka
+ clj-kondo: latest # Clj-kondo
+ cljstyle: latest # cljstyle
+ zprint: latest # zprint
+ - name: eastwood lint
+ run: |
+ java -version
+ lein eastwood
+ - name: Run lein tests with update profile
+ run: |
+ set -x
+ set -e
+ lein version
+ sudo apt-get update && sudo apt-get install -y gettext
+ echo "Making resources/locales.clj"
+ make
+ echo "Running tests"
+ lein -U test
+
+ tests:
+ if: always()
+ needs:
+ - run-lein-tests
+ runs-on: ubuntu-24.04
+ name: Test suite
+ steps:
+ - name: Decide whether the needed jobs succeeded or failed
+ uses: re-actors/alls-green at release/v1
+ with:
+ jobs: ${{ toJSON(needs) }}
=====================================
.github/workflows/release.yaml
=====================================
@@ -0,0 +1,18 @@
+---
+name: Release and publish package to clojars.org
+
+permissions:
+ contents: write
+ packages: write
+
+on:
+ workflow_dispatch:
+
+jobs:
+ release:
+ uses: 'openvoxproject/shared-actions/.github/workflows/clojure_release.yml at main'
+ secrets:
+ github_pat: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }}
+ ssh_private_key: ${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}
+ clojars_username: ${{ secrets.CLOJARS_USERNAME }}
+ clojars_password: ${{ secrets.CLOJARS_PASSWORD }}
=====================================
.travis.yml deleted
=====================================
@@ -1,24 +0,0 @@
-language: clojure
-lein: 2.9.1
-jobs:
- include:
- - stage: jdk8
- dist: xenial
- jdk: openjdk8
- - stage: jdk11
- dist: bionic
- jdk: openjdk11
- - stage: lint jdk11
- dist: bionic
- jdk: openjdk11
- script: |
- set -e
- ./dev-setup
- set -x
- lein eastwood
- lein check
- set +x
-script: "./ext/travisci/test.sh"
-branches:
- only:
- - main
=====================================
CODEOWNERS deleted
=====================================
@@ -1,2 +0,0 @@
-# default to the dumpling team
-* @puppetlabs/dumpling
=====================================
README.md
=====================================
@@ -130,9 +130,9 @@ On Red Hat-based operating systems, including Fedora, install gettext via
### Project setup
-[](https://clojars.org/puppetlabs/i18n)
+[](https://clojars.org/org.openvoxproject/i18n)
-1. In your `project.clj`, add `[puppetlabs/i18n "0.9.0"]` to your project's
+1. In your `project.clj`, add `[org.openvoxproject/i18n "0.9.0"]` to your project's
:plugins and :dependencies vectors (without the version number in
:dependencies if your project uses clj-parent). Also add
```
@@ -157,11 +157,6 @@ On Red Hat-based operating systems, including Fedora, install gettext via
start with a prefix derived from the project name:** you'll need to list all
of your namespaces/package name prefixes in the `PACKAGES` variable in the
top level `Makefile` before the inclusion of the `dev-resources/Makefile.i18n`
-4. Add a job using [CI job configs' i18n-clj template][ci-job] to your project's
- CI pipelines. This job will automatically update the POT file when
- externalized strings are added or changed in the project.
-
-[ci-job]: https://github.com/puppetlabs/ci-job-configs/blob/master/resources/job-templates/i18n-clj.yaml
This setup will ensure that compiling your project will also regenerate the Java
`ResourceBundle` classes that your code needs to do translations.
@@ -269,7 +264,6 @@ The code is set up as an ordinary leiningen project, with the one exception
that you need to run `make` before running `lein test` or `lein run`, as
there are messages that need to be turned into a message bundle.
-# Maintenance
+## Support
-Maintainers: David Lutterkort <lutter at puppetlabs.com> and Libby Molina <libby at puppetlabs.com>
-Tickets: File bug tickets at https://tickets.puppetlabs.com/browse/INTL, and add the `clj` component to the ticket.
+GitHub issues and PRs are welcome! Additionally, drop us a line in [the Vox Pupuli Slack or IRC channel](https://voxpupuli.org/connect/).
=====================================
example/program/project.clj
=====================================
@@ -1,10 +1,10 @@
-(defproject puppetlabs/i18n-example-program "0.1.0"
+(defproject org.openvoxproject/i18n-example-program "0.1.0"
:description "A sample use of the i18n library"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
- :dependencies [[org.clojure/clojure "1.6.0"]
- [puppetlabs/i18n "0.1.0-SNAPSHOT"]]
- :plugins [[puppetlabs/i18n "0.1.0-SNAPSHOT"]]
+ :dependencies [[org.clojure/clojure "1.12.4"]
+ [org.openvoxproject/i18n "1.0.2"]]
+ :plugins [[org.openvoxproject/i18n "1.0.2"]]
:main puppetlabs.i18n-example-program.main
:aot [puppetlabs.i18n-example-program.main])
=====================================
ext/travisci/test.sh deleted
=====================================
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-./dev-setup
-lein test
=====================================
project.clj
=====================================
@@ -1,21 +1,30 @@
-(defproject puppetlabs/i18n "0.9.2"
+(defproject org.openvoxproject/i18n "1.0.4"
:description "Clojure i18n library"
- :url "http://github.com/puppetlabs/clj-i18n"
+ :url "http://github.com/openvoxproject/clj-i18n"
:license {:name "Apache License, Version 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:pedantic? :abort
- :dependencies [[org.clojure/clojure "1.10.1"]
- [cpath-clj "0.1.2"]
- [org.gnu.gettext/libintl "0.18.3"]]
- :profiles {:dev {:dependencies [[puppetlabs/kitchensink "3.1.3"
- :exclusions [org.clojure/clojure]]]
- :plugins [[jonase/eastwood "0.8.1"
+ ;; Generally, try to keep version pins in :managed-dependencies and the libraries
+ ;; this project actually uses in :dependencies, inheriting the version from
+ ;; :managed-dependencies. This prevents endless version conflicts due to deps of deps.
+ ;; Renovate should keep the versions largely in sync between projects.
+ :managed-dependencies [[org.clojure/clojure "1.12.4"]
+ [cpath-clj "0.1.2"]
+ [org.gnu.gettext/libintl "0.18.3"]
+ [org.openvoxproject/kitchensink "3.5.7"]]
+
+ :dependencies [[org.clojure/clojure]
+ [cpath-clj]
+ [org.gnu.gettext/libintl]]
+
+ :profiles {:dev {:dependencies [[org.openvoxproject/kitchensink]]
+ :plugins [[jonase/eastwood "1.4.3"
:exclusions [org.clojure/clojure]]]}}
:deploy-repositories [["releases" {:url "https://clojars.org/repo"
- :username :env/clojars_jenkins_username
- :password :env/clojars_jenkins_password
+ :username :env/CLOJARS_USERNAME
+ :password :env/CLOJARS_PASSWORD
:sign-releases false}]]
:eval-in-leiningen true)
=====================================
renovate.json
=====================================
@@ -0,0 +1,10 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "addLabels": ["renovate", "dependencies"],
+ "assigneesFromCodeOwners": true,
+ "automerge": true,
+ "automergeType": "pr",
+ "dependencyDashboard": true,
+ "enabledManagers": ["leiningen"],
+ "ignorePaths": ["example/program/project.clj"]
+}
=====================================
src/leiningen/i18n.clj
=====================================
@@ -32,7 +32,7 @@
dev-resources or create dev-resources in the first :source-paths"
[project]
(or
- (first (filter #(.endsWith % "dev-resources") (:resource-paths project)))
+ (first (filter #(.endsWith ^String % "dev-resources") (:resource-paths project)))
(l/abort "You must have a dev-resources directory in your project's resource-paths")))
(defn dev-resources-dir
=====================================
src/puppetlabs/i18n/core.clj
=====================================
@@ -3,7 +3,10 @@
(:require [clojure.java.io :as io]
[clojure.set]
[clojure.edn :as edn]
- [clojure.string :as str]))
+ [clojure.string :as str])
+ (:import (gnu.gettext GettextResource)
+ (java.text MessageFormat)
+ (java.util Comparator Locale MissingResourceException)))
;;; General setup/info
(defn info-files
@@ -11,9 +14,9 @@
a seq of URLs"
[]
(-> (Thread/currentThread)
- .getContextClassLoader
- (.getResources "locales.clj")
- enumeration-seq))
+ .getContextClassLoader
+ (.getResources "locales.clj")
+ enumeration-seq))
(defn parse-info-file
"This function will handle the normal locales.clj file the Makefile builds in
@@ -48,12 +51,12 @@
item
(throw
(Exception.
- (format "Invalid locales info: %s: :locales must be a nonempty set"
- (:source item)))))
+ ^String (format "Invalid locales info: %s: :locales must be a nonempty set"
+ (:source item)))))
(throw
(Exception.
- (format "Invalid locales info: %s: missing :locales"
- (:source item))))))
+ ^String (format "Invalid locales info: %s: missing :locales"
+ (:source item))))))
(check-and-normalize-packages [item]
(if-let [packages (:packages item)]
(if (coll? packages)
@@ -61,22 +64,22 @@
(dissoc :package)) ; just to make sure we don't have both: :packages & :package
(throw
(Exception.
- (format "Invalid locales info: %s: :packages must be a collection"
- (:source item)))))
+ ^String (format "Invalid locales info: %s: :packages must be a collection"
+ (:source item)))))
(if-let [package (:package item)] ; for backwards compatibility: transform :package to :packages
(-> item
(dissoc :package)
(assoc :packages [package]))
(throw
(Exception.
- (format "Invalid locales info: %s: missing :packages"
- (:source item)))))))]
+ ^String (format "Invalid locales info: %s: missing :packages"
+ (:source item)))))))]
(->> (info-files)
(mapcat parse-info-file)
(map (comp check-and-normalize-packages check-locales)))))
(def string-length-comparator
- (reify java.util.Comparator
+ (reify Comparator
(compare [_ lhs rhs]
(clojure.core/compare (count rhs) (count lhs)))))
@@ -100,10 +103,10 @@
(if (set? source-new) source-new #{source-new})))}
(throw
(Exception.
- (format "Invalid locales info: %s and %s are both for package %s but set different bundles %s and %s"
- (:source old) (:source new)
- package
- bundle-old bundle-new)))))
+ ^String (format "Invalid locales info: %s and %s are both for package %s but set different bundles %s and %s"
+ (:source old) (:source new)
+ package
+ bundle-old bundle-new)))))
new))]
(reduce
(fn [map item]
@@ -139,7 +142,7 @@
(defn system-locale
"Get the globally set locale"
[]
- (. java.util.Locale getDefault))
+ (. Locale getDefault))
(def ^:dynamic *locale*
"The current user locale. You should not modify this variable
@@ -152,11 +155,11 @@
"Evaluate body with the user locale set to locale"
[locale & body]
`(let [locale# ~locale]
- (if (instance? java.util.Locale locale#)
+ (if (instance? Locale locale#)
(binding [*locale* locale#] ~@body)
(throw (IllegalArgumentException.
- (str "Expected java.util.Locale but got "
- (.getName (class locale#))))))))
+ ^String (str "Expected java.util.Locale but got "
+ (.getName (class locale#))))))))
(defn user-locale
"Return the user's preferred locale. If none is set, return the system
@@ -168,7 +171,7 @@
;; we need to make sure we have the right one. For example, "en_US" leads
;; to a bad locale, whereas "en-us" works
(defn string-as-locale [loc]
- (java.util.Locale/forLanguageTag loc))
+ (Locale/forLanguageTag loc))
(defn message-locale
"The locale of the untranslated messages. This is used as a fallback if
@@ -196,15 +199,15 @@
(defn get-bundle
"Get the java.util.ResourceBundle for the given locale (a string)"
- [namespace ^java.util.Locale loc]
+ [namespace ^Locale loc]
(try
(let [^String base-name (bundle-for-namespace namespace)]
(and base-name
- (gnu.gettext.GettextResource/getBundle base-name loc)))
- (catch java.lang.NullPointerException e
+ (GettextResource/getBundle base-name loc)))
+ (catch NullPointerException _e
;; base-name or loc were nil
nil)
- (catch java.util.MissingResourceException e
+ (catch MissingResourceException _e
;; no bundle for the base-name and/or locale
nil)))
@@ -217,8 +220,8 @@
(let [bundle (get-bundle namespace loc)]
(if (and bundle (not-empty msg))
(try
- (gnu.gettext.GettextResource/gettext bundle msg)
- (catch java.util.MissingResourceException e
+ (GettextResource/gettext bundle msg)
+ (catch MissingResourceException _e
;; no key for msg
msg))
msg)))
@@ -231,8 +234,8 @@
(let [bundle (get-bundle namespace loc)]
(if (and bundle (not-empty msgid))
(try
- (gnu.gettext.GettextResource/ngettext bundle msgid msgid-plural count)
- (catch java.util.MissingResourceException e
+ (GettextResource/ngettext bundle msgid msgid-plural count)
+ (catch MissingResourceException e
;; no key for msg
(if (= count 1) msgid msgid-plural)))
(if (= count 1) msgid msgid-plural))))
@@ -248,7 +251,9 @@
([loc msg args]
;; we might want to cache these MessageFormat's in some way
;; maybe in a size-bounded LRU cache
- (.format (new java.text.MessageFormat msg loc) (to-array args))))
+ (->(new MessageFormat msg loc)
+ (.format (to-array args) (new StringBuffer) nil)
+ (.toString))))
(defn translate
"Translate a message into the given locale, interpolating as
=====================================
test/puppetlabs/i18n/bin_test.clj
=====================================
@@ -3,9 +3,7 @@
[clojure.string :as str]
[clojure.test :refer :all]
[clojure.java.shell :refer [sh]]
- [puppetlabs.kitchensink.core :as ks])
- (:import
- (java.nio.file Path)))
+ [puppetlabs.kitchensink.core :as ks]))
(defn git-head-sha
[]
@@ -23,7 +21,7 @@
(io/copy (io/file resource) temp-file)
temp-file))
-(defn- path [^Path f] (.getPath f))
+(defn- path [^java.io.File f] (.getPath f))
(deftest add-gitref-test
(testing "the src/leiningen/i18n/bin/add-gitref.sh script"
=====================================
test/puppetlabs/i18n/core_test.clj
=====================================
@@ -1,27 +1,27 @@
(ns puppetlabs.i18n.core-test
(:require
- [clojure.java.io :as io]
- [clojure.pprint :refer [pprint]]
- [clojure.test :refer :all]
- [puppetlabs.i18n.core
- :refer [as-number
- available-locales
- bundle-for-namespace
- info-map'
- locale-negotiator
- negotiate-locale
- parse-http-accept-header
- string-as-locale
- system-locale
- trs
- trsn
- tru
- trun
- user-locale
- with-user-locale]]))
+ [clojure.java.io :as io]
+ [clojure.test :refer :all]
+ [puppetlabs.i18n.core
+ :refer [as-number
+ available-locales
+ bundle-for-namespace
+ info-map'
+ locale-negotiator
+ negotiate-locale
+ parse-http-accept-header
+ string-as-locale
+ system-locale
+ trs
+ trsn
+ tru
+ trun
+ user-locale
+ with-user-locale]])
+ (:import (java.util Locale)))
;; Set the JVM's default locale so we run in a known environment
-(. java.util.Locale setDefault (string-as-locale "en-US"))
+(. Locale setDefault (string-as-locale "en-US"))
(def de (string-as-locale "de-DE"))
(def eo (string-as-locale "eo"))
@@ -61,7 +61,14 @@
(testing "tru in Esperanto"
;; We use Esperanto as our test locale
(with-user-locale eo
- (is (= welcome_eo (tru welcome_en))))))
+ (is (= welcome_eo (tru welcome_en)))))
+ (testing "multiple argument formatting not in the POT file"
+ (is (= "This is a format string with one, 2, three, 4 arguments" (trs "This is a format string with {0}, {1}, {2}, {3} arguments" "one" 2 "three" 4))))
+ (testing "multiple argument formatting"
+ (is (= "It took 5 programmers 10 months to implement this" (tru "It took {0} programmers {1} months to implement this" 5 10))))
+ (testing "multiple argument formatting with a user locale"
+ (with-user-locale de
+ (is (= "5 Programmierer brauchten 10 Monat(e) um das zu implementieren" (tru "It took {0} programmers {1} months to implement this" 5 10))))))
(deftest test-trun
(testing "trun with no user locale"
@@ -77,8 +84,14 @@
(is (= welcome_en (trs welcome_en))))
(testing "trs with a user locale"
(with-user-locale de
- (is (= welcome_en (trs welcome_en))))))
-
+ (is (= welcome_en (trs welcome_en)))))
+ (testing "multiple argument formatting not in the POT file"
+ (is (= "This is a format string with one, 2, three, 4 arguments" (trs "This is a format string with {0}, {1}, {2}, {3} arguments" "one" 2 "three" 4))))
+ (testing "multiple argument formatting"
+ (is (= "It took 5 programmers 10 months to implement this" (trs "It took {0} programmers {1} months to implement this" 5 10))))
+ (testing "multiple argument formatting with a user locale"
+ (with-user-locale de
+ (is (= "It took 5 programmers 10 months to implement this" (trs "It took {0} programmers {1} months to implement this" 5 10))))))
(deftest test-trsn
(testing "trsn with no user locale"
View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/commit/dfe3798fb2fe52526f3abf4fc8beaebdf6d18acd
--
View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/commit/dfe3798fb2fe52526f3abf4fc8beaebdf6d18acd
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20260718/f1d79897/attachment.htm>
More information about the pkg-java-commits
mailing list