[Git][clojure-team/puppetlabs-i18n-clojure][upstream] New upstream version 0.9.0

Louis-Philippe Véronneau gitlab at salsa.debian.org
Thu Dec 17 22:23:19 GMT 2020



Louis-Philippe Véronneau pushed to branch upstream at Debian Clojure Maintainers / puppetlabs-i18n-clojure


Commits:
8f883caf by Louis-Philippe Véronneau at 2020-12-14T12:44:29-05:00
New upstream version 0.9.0
- - - - -


7 changed files:

- .travis.yml
- + CODEOWNERS
- README.md
- project.clj
- − src/i18n/plugin.clj
- src/leiningen/i18n/Makefile
- src/puppetlabs/i18n/core.clj


Changes:

=====================================
.travis.yml
=====================================
@@ -1,8 +1,13 @@
 language: clojure
-lein: 2.7.1
-jdk:
-- openjdk7
-- oraclejdk8
+lein: 2.9.1
+jobs:
+  include:
+    - stage: jdk8
+      dist: xenial
+      jdk: openjdk8
+    - stage: jdk11
+      dist: bionic
+      jdk: openjdk11
 script: "./ext/travisci/test.sh"
 branches:
   only:


=====================================
CODEOWNERS
=====================================
@@ -0,0 +1,2 @@
+# default to the dumpling team
+* @puppetlabs/dumpling


=====================================
README.md
=====================================
@@ -45,6 +45,25 @@ to determine the level of pluralization.  Any additional arguments will be used
 
     (println (trsn "We found one cute puppy" "We found {0} cute puppies" 5))
 
+Use `format` to keep whitespace out of translations:
+Replace the following string
+
+    (str "Verification of client "
+      client
+      " provided by HTTP header "
+      header
+      "\nSee documentation for details\n")
+
+with something like:
+
+    (format "%s\n%s\n"
+      (trs "Verification of client {0} provided by HTTP header {1}" client header)
+      (trs "See documentation for details"))
+
+Note that `trs` and `tru` work exactly the same way as `format` in clojure, and
+that it does not concatenate the way `str` does. If used this way, `trs` and
+`tru` will only recognize the first string given and no exception will be thrown.
+
 ### How to find the Strings
 
 Here is a crappy Ruby script that you can point at a Clojure source tree to find *most* of the strings that will need to be translated:
@@ -113,7 +132,7 @@ On Red Hat-based operating systems, including Fedora, install gettext via
 
 [![Clojars Project](https://img.shields.io/clojars/v/puppetlabs/i18n.svg)](https://clojars.org/puppetlabs/i18n)
 
-1. In your `project.clj`, add `[puppetlabs/i18n "0.5.0"]` to your project's
+1. In your `project.clj`, add `[puppetlabs/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
    ```
@@ -121,8 +140,10 @@ On Red Hat-based operating systems, including Fedora, install gettext via
                                         (fn [new prev]
                                           (if (map? prev) [new prev] (conj prev new)))
                                         #(spit %1 (pr-str %2))]}
+   :prep-tasks [["i18n" "make"] "javac" "compile"]
    ```
-   to merge in the translation locales.clj from upstream projects.
+   to merge in the translation locales.clj from upstream projects and make sure the plugin is
+   invoked.
 2. Run `lein i18n init`. This will
    * put a `Makefile.i18n` into `dev-resources/` in your project and include it
      into an existing toplevel `Makefile` resp. create a new one that does that.
@@ -132,8 +153,6 @@ On Red Hat-based operating systems, including Fedora, install gettext via
      include your project name, so that the POT file will be named after your project.)
      These are used by [the clj-i18n CI job][ci-job]
      and can be ignored (they are added to the project's .gitignore file).
-   * add hooks to the `compile` task that will rebuild the resource bundles
-     (equivalent of running `make i18n`).
 3. **If there are namespaces/packages in your project with names which do not
    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


=====================================
project.clj
=====================================
@@ -1,11 +1,11 @@
-(defproject puppetlabs/i18n "0.8.0"
+(defproject puppetlabs/i18n "0.9.0"
   :description "Clojure i18n library"
   :url "http://github.com/puppetlabs/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.6.0"]
+  :dependencies [[org.clojure/clojure "1.10.1"]
                  [cpath-clj "0.1.2"]
                  [org.gnu.gettext/libintl "0.18.3"]]
 


=====================================
src/i18n/plugin.clj deleted
=====================================
@@ -1,14 +0,0 @@
-(ns i18n.plugin
-  (:require [leiningen.core.main :as l]
-            [robert.hooke :as rh]
-            [leiningen.compile]
-            [clojure.java.shell :as sh :refer [sh]]))
-
-(defn compile-hook
-  [task project]
-  (l/debug "i18n: running 'make i18n'")
-  (sh "make" "i18n")
-  (task project))
-
-(defn hooks []
-  (rh/add-hook #'leiningen.compile/compile #'compile-hook))


=====================================
src/leiningen/i18n/Makefile
=====================================
@@ -85,7 +85,7 @@ $(LOCALES_CLJ): | resources
 clean-orphaned-bundles:
 	@for bundle in resources/$(BUNDLE_DIR)/Messages_*.class; do                                  \
 	  locale=$$(basename "$$bundle" | sed -E -e 's/\$$?1?\.class$$/_class/' | cut -d '_' -f 2;); \
-	  if [ ! -f "locales/$$locale.po" ]; then                                                    \
+	  if [ ! -f "locales/$$locale.po" -a -f "$$bundle" ]; then                                                    \
 	    rm "$$bundle";                                                                           \
 	  fi                                                                                         \
 	done


=====================================
src/puppetlabs/i18n/core.clj
=====================================
@@ -253,14 +253,14 @@
   "Translate a message into the given locale, interpolating as
   needed. Messages are looked up in the resource bundle associated with the
   given namespace"
-  [namespace loc msg & args]
+  ^String [namespace loc msg & args]
   (fmt loc (lookup namespace loc msg) (to-array args)))
 
 (defn translate-plural
   "Translate a message into the given locale, interpolating as
   needed. The count argument can be interpolated as {0}.  Messages are looked
   up in the resource bundle associated with the given namespace"
-  [namespace loc msgid msgid-plural count & args]
+  ^String [namespace loc msgid msgid-plural count & args]
   (fmt loc (lookup-plural namespace loc msgid msgid-plural count) (to-array (cons count args))))
 
 (defmacro tru



View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/commit/8f883cafab33ed8ac2c944745cb3790f0c1ecbf6

-- 
View it on GitLab: https://salsa.debian.org/clojure-team/puppetlabs-i18n-clojure/-/commit/8f883cafab33ed8ac2c944745cb3790f0c1ecbf6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20201217/d87eb6da/attachment.html>


More information about the pkg-java-commits mailing list