Created
July 5, 2017 12:53
-
-
Save zetafish/baac52da61bcdb73a9754b790aca1164 to your computer and use it in GitHub Desktop.
Locale Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns core | |
(:import (java.util Locale | |
Locale$Category | |
Locale$LanguageRange))) | |
(def configured-languages | |
[(Locale. "en") (Locale. "nl") (Locale. "en" "US") (Locale. "fil")]) | |
(def accept-languages | |
(Locale$LanguageRange/parse "fil,nl;q=0.8,en-GB;q=0.6,en;q=0.4,en-US;q=0.2")) | |
;; Get the best matching language | |
(->> | |
(Locale/filter accept-languages configured-languages) | |
(first) | |
(.getLanguage)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment