Skip to content

Commit

Permalink
v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Aug 28, 2014
1 parent e6cb9ee commit 7e5be73
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
53 changes: 26 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**.
## v2.1.0-RC2 / 2014 Jul 12
## v3.0.0 / 2014 Aug 28

> This is a **major update** that **may be BREAKING** in certain cases.
>
> Sorry about the hassle. The changes were necessary as part of an overhaul to the translation system for portability to ClojureScript.
> This is a **major update** that **may be BREAKING** for users upgrading from < `v2.1.0-RC1`.
> It introduces ClojureScript translation support and fixes a number of useability sharp edges.
* **NEW**: Added experimental ClojureScript translation support. See the README for an example and notes.
* **FIX**: All localization formatters are now correctly thread safe.

* **DEPRECATED**: `wrap-tower-middleware` -> `wrap-tower`. This is a recommended change, but it's **BREAKING** if you make it:
* **NEW**: Added ClojureScript translation support. See the README for an example and notes.
* **NEW**: `timezones` fn now supports optional timezone-ids arg.
* **NEW**: Add `all-timezone-ids` set.
* **NEW** [#42]: Translation dictionary now supports underscores in translation keys.
* **NEW** [#43]: Translation fns can now take a _vector_ of descending-preference locales (@vvvvalvalval).
* **NEW** [#43]: Ring middleware now automatically attaches a smarter translation fn that'll search through all of a client's sorted Accept-Language header languages when looking for a translation.
* **NEW** [#50], [#52]: Translation dictionary now supports arbitrary (non-JVM) locales.

* **CHANGE**: Dropped (experimental) `:scope-var` tconfig option.
* **CHANGE**: Dropped (experimental) `:root-scope` tconfig option.
* **CHANGE**: Default :missing translations entry now avoids <>'s (no need for html escaping).
* **CHANGE**: `languages` now returns languages as "localized (unlocalized)" pairs rather than "unlocalized (localized)" pairs.
* **CHANGE**: All `Exception`s are now `ExceptionInfo`s.

* **POSSIBLY BREAKING**: `translate` and `t` are both being phased out in favor of a new `make-t` fn. The new approach is more flexible and faster. This change is _non-breaking_ **if** you use the Ring middleware; otherwise please see the README for new recommended usage examples.

* **DEPRECATED**: `locale`->`jvm-locale`, `try-locale`->`try-jvm-locale` (only the names have changed).
* **DEPRECATED**: `wrap-tower-middleware` -> `wrap-tower`. This is a recommended change, but it's **BREAKING** if you make it:
```clojure
;;; 1. The fn signature has changed (tconfig is now an explicit arg):
(wrap-tower-middleware <ring-handler> {:tconfig _ <other opts>}) ; old
(wrap-tower-middleware <ring-handler> {:tconfig _ <other opts>}) ; Old
;; vs
(wrap-tower <ring-handler> <tconfig> {<other-opts>}) ; new
(wrap-tower <ring-handler> <tconfig> {<other-opts>}) ; New

;;; 2. The Ring request's `:t` key has changed:
{:locale _ :t (fn [k-or-ks & fmt-args])} ; old
{:locale _ :t (fn [k-or-ks & fmt-args])} ; Old
;; vs
{:locale _ :t (fn [locale k-or-ks & fmt-args]) ; Now takes a locale
:t' (fn [k-or-ks & fmt-args])} ; new
:t' (fn [k-or-ks & fmt-args])} ; New, behaves like old `:t`
```

The new behaviour is more consistent. `t` always refers to a translation fn that takes a locale arg, and `t'` always refer to a partial translation fn that has already been provided a locale arg.

**Migrate** by swapping your middleware, and using `t'` instead of `t` as your locale-less translation fn. **OR** you can give a `:legacy-t? true` opt to `wrap-tower` to keep the old behaviour.

* **DEPRECATED, POSSIBLY BREAKING**: `translate` and `t` are both being phased out in favor of a new `make-t` fn. The new approach is more flexible and faster. This change is _non-breaking_ **if** you use the Ring middleware; otherwise please see the README for new recommended usage examples.
* Dropped (experimental) `:scope-var` tconfig option.
* Dropped (experimental) `:root-scope` tconfig option.

* **CHANGE**: Default :missing translations entry now avoids <>'s (no need for html escaping).
* **CHANGE**: `languages` now returns languages as "localized (unlocalized)" pairs rather than "unlocalized (localized)" pairs.
* **CHANGE** (from RC1): ClojureScript macros are now in primary `tower.clj` ns.
* **NEW**: `timezones` fn now supports optional timezone-ids arg.
* **NEW**: Add `all-timezone-ids` set.
* **NEW**: `locale`, `try-locale` now have an optional arg to return simplified (lang-only) locales.
* [#43] **NEW**: Translation fns can now take a _vector_ of descending-preference locales (@vvvvalvalval).
* [#43] **NEW**: Ring middleware now automatically attaches a smarter translation fn that'll search through all of a client's sorted Accept-Language header languages when looking for a translation.
* **FIX**: All localization formatters are now correctly thread safe.
The new behaviour is more consistent. `t` always refers to a translation fn that takes a locale arg, and `t'` always refer to a partial translation fn that has already been provided a locale arg. **Migrate** by swapping your middleware, and using `t'` instead of `t` as your locale-less translation fn. **OR** you can give a `:legacy-t? true` opt to `wrap-tower` to keep the old behaviour.


## v2.0.2 / 2014 Jan 19
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
**[API docs][]** | **[CHANGELOG][]** | [other Clojure libs][] | [Twitter][] | [contact/contrib](#contact--contributing) | current [Break Version][]:

```clojure
[com.taoensso/tower "2.0.2"] ; Stable
[com.taoensso/tower "2.1.0-RC2"] ; Development
[com.taoensso/tower "3.0.0"] ; Please see CHANGELOG for possible breaking changes
```

v2.1 is a major release that **may be BREAKING** in certain cases. It adds _experimental_ ClojureScript translation support. Please see the [CHANGELOG][] for details.
v3 is a major release that **may be BREAKING**. It adds ClojureScript translation support and fixes a number of sharp edges. Please see the [CHANGELOG][] for details.

Special thanks to **Janne Asmala** ([GitHub](https://github.com/asmala) & [Twitter](https://twitter.com/janne_asmala)) for his awesome contributions to Tower's v2 design. He also has an i18n/L10n lib called [clj18n](https://github.com/asmala/clj18n) which is definitely worth checking out!

Expand All @@ -32,7 +31,7 @@ Tower's an attempt to present a **simple, idiomatic internationalization and loc
Add the necessary dependency to your [Leiningen][] `project.clj` and `require` the library in your ns:

```clojure
[com.taoensso/tower "2.0.2"] ; project.clj
[com.taoensso/tower "3.0.0"] ; project.clj
(ns my-app (:require [taoensso.tower :as tower :refer (with-tscope)])) ; ns
```

Expand Down Expand Up @@ -118,7 +117,7 @@ And even fallback locales. `(t [:fr-FR :en-US] :example/foo)` searches:

In all cases, translation requests are logged upon fallback to fallback locale or :missing key.

#### ClojureScript translation support (still experimental!)
#### ClojureScript translations (early support)

```clojure
(ns my-clojurescript-ns
Expand All @@ -135,7 +134,7 @@ In all cases, translation requests are logged upon fallback to fallback locale o
(t :en-US :example/foo) => ":en-US :example/foo text"
```

There's two notable differences from the JVM translator:
There's two notable differences from JVM translations:

1. The dictionary is provided in a _pre-compiled_ form so that it can be inlined directly into your Cljs.
2. Since we lack a locale-aware Cljs `format` fn, your translations _cannot_ use JVM locale formatting patterns.
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.taoensso/tower "2.1.0-RC2"
(defproject com.taoensso/tower "3.0.0"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Clojure i18n & L10n library"
:url "https://github.com/ptaoussanis/tower"
Expand Down

0 comments on commit 7e5be73

Please sign in to comment.