Skip to content

Commit

Permalink
languages now returns "localized (unlocalized)" pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Apr 20, 2014
1 parent 315282d commit 20afe81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Pending / unreleased

* **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.


## v2.1.0-RC1 / 2014 Mar 30
Expand Down
11 changes: 6 additions & 5 deletions src/taoensso/tower.clj
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,14 @@
([loc iso-languages]
(get-localized-sorted-map iso-languages (locale loc)
(fn [code] (let [Loc (Locale. (name code))]
(str (.getDisplayLanguage Loc (locale loc))
;; Also provide each name in it's OWN language
(when (not= Loc (locale loc))
(str " (" (.getDisplayLanguage Loc Loc) ")"))))))))))
(str (.getDisplayLanguage Loc Loc) ; Lang, in itself
(when (not= Loc (locale loc))
(format " (%s)" ; Lang, in current lang
(.getDisplayLanguage Loc (locale loc))))))))))))

(comment (countries :en)
(languages :pl [:en :de :pl]))
(languages :pl [:en :de :pl])
(languages :en [:en :de :pl]))

;;;; Timezones (doesn't depend on locales)

Expand Down

0 comments on commit 20afe81

Please sign in to comment.