reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Issue #84: L10n #91

Closed jaaqo closed 8 years ago

jaaqo commented 8 years ago

Datepicker now accepts :lang which takes a keyword which maps to built-in languages like :en-US.

Currently provides English, Russian, French, Spanish, Portuguese and Finnish mappings. Also, the :lang key accepts a language hash-map with correct format.

Language hash-maps must define :first-day key which allow choosing arbritrary first day of the week by index starting from Sunday as 0. Choosing :first-day 1 would render monday as the first day of the week.

Also moved functions related to gen-days above it for clarity.

Example usage:

{:field :datepicker :id :date :date-format "yyyy/mm/dd" :inline true :lang
 {:days        ["First" "Second" "Third" "Fourth" "Fifth" "Sixth" "Seventh"]
  :days-short  ["1st" "2nd" "3rd" "4th" "5th" "6th" "7th"]
  :months      ["Month-one" "Month-two" "Month-three" "Month-four" "Month-five" "Month-six"
                "Month-seven" "Month-eight" "Month-nine" "Month-ten" "Month-eleven" "Month-twelve"]
  :months-short ["M1" "M2" "M3" "M4" "M5" "M6" "M7" "M8" "M9" "M10" "M12"]
  :first-day 0}}

image

{:field :datepicker :id :date :date-format "yyyy/mm/dd" :inline true :lang :ru-RU}

image

{:field :datepicker :id :date :date-format "yyyy/mm/dd" :inline true}

image

yogthos commented 8 years ago

looks great, might be worth updating the readme to reflect the new options too :)

yogthos commented 8 years ago

and I just pushed to Clojars