   (let [data-dir (get-in ctx [:config :core :data-dir])
         site-url (get-in ctx [:config :core :site-url])
         badges (pdf-generator-helper ctx user-id input)
-        ul (:language (ud/user-information ctx user-id))
+        user-data (ud/user-information ctx user-id)
+        ul (if (blank? (:language user-data)) "en" (:language user-data))
         font-path  (first (mapcat #(get-in ctx [:config % :font] []) (get-plugins ctx)))
         font  {:ttf-name (str site-url font-path)}
         stylesheet {:heading-name {:color [127 113 121]


        pdf-settings  (if (empty? font-path) {:stylesheet stylesheet  :bottom-margin 0 :footer {:page-numbers false :align :right}} {:font font :stylesheet stylesheet  :bottom-margin 0 :footer {:page-numbers false :align :right}})
        badge-template (pdf/template
                         (let [template #(cons [:paragraph]  [ (if (and (not (blank? (:image_file %)))(ends-with? (:image_file %) "png"))
                                                                 [:image {:width 100 :height 100 :align :center} (str data-dir "/" (:image_file %))]
                                                                 [:image {:width 100 :height 100 :align :center :base64 true} $qr_code ])

                                                               [:heading.heading-name (:name %)]
                                                               [:paragraph {:indent 20 :align :center}#_[:line] [:spacer]]
                                                               [:paragraph.generic {:align :left :style :italic} (or (:description %) "-")][:spacer]
                                                               [:paragraph.generic
                                                                [:chunk.chunk (str (t :badge/Recipient ul)": ")] (str $first_name  " " $last_name ) "\n"
                                                                [:chunk.chunk (str (t :badge/Issuedby ul)": ")] (or (:issuer_content_name %) "-")"\n"
                                                                (when-not (blank? (:creator_name %))
                                                                  [:paragraph.generic
                                                                   [:chunk.chunk (str (t :badge/Createdby ul)": ")] (:creator_name %)])
                                                                (when-not (blank? (str $issued_on))
                                                                  [:chunk.chunk (str (t :badge/Issuedon ul)": ")] (date-from-unix-time (long (* 1000 $issued_on)) "date") "\n")
                                                                (when-not (blank? (str $expires_on))
                                                                  [:paragraph
                                                                   [:chunk.chunk (str (t :badge/Expireson ul)": ")] (date-from-unix-time (long (* 1000 $expires_on)) "date")])

                                                                (when-not (empty? $tags)
                                                                  [:paragraph.generic
                                                                   [:chunk.chunk (str (t :badge/Tags ul)": ")] (into [:phrase ] (for [t $tags] (str t " ")))])
                                                                [:paragraph
                                                                 (let [alignments (select-alignment-content {:badge_content_id (:badge_content_id %)} (u/get-db ctx))]
                                                                   (when-not (empty? alignments)
                                                                     [:paragraph.generic
                                                                      [:spacer 0]
                                                                      [:phrase {:size 12 :style :bold} (str (t :badge/Alignments ul)": " (count alignments))]"\n"
                                                                      (into [:paragraph ] (for [a alignments]
                                                                                            [:paragraph
                                                                                             (or (:name a) "-")"\n"
                                                                                             [:chunk {:style :italic}(or (:description a) "-")] "\n"
                                                                                             [:chunk.link (or (:url a) "-")] [:spacer 0]]) )]))]
                                                                [:paragraph
                                                                 [:chunk.chunk (str (t :badge/Criteria ul)": ")] [:anchor {:target (:criteria_url %) :style{:family :times-roman :color [66 100 162]}} (or (:criteria_url %) "-")]]
                                                                [:spacer 0]
                                                                (when-not (blank? (:criteria_content %))
                                                                  [:phrase.generic
                                                                   [:chunk.chunk  (t :badge/Criteria ul)] ]"\n"
                                                                  (markdown->clj-pdf {:spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2} :wrap {:global-wrapper :paragraph}} (:criteria_content %)))]

                                                               (when-not (empty? $endorsements)
                                                                 [:paragraph.generic

                                                                  [:spacer 0]
                                                                  (into [:paragraph {:indent 0} ] (for [e $endorsements]
                                                                                                    [:paragraph
                                                                                                     (:issuer_name e) "\n"
                                                                                                     [:anchor {:target (:issuer_url e) :style{:family :times-roman :color [66 100 162]}} (or (:issuer_url e) "-")] "\n"
                                                                                                     [:chunk (if (number? (:issued_on e)) (date-from-unix-time (long (* 1000 (:issued_on e)))) (:issued_on e))] "\n"
                                                                                                     (process-markdown "Endorsements" (:content e))]))])

                                                               [:line {:dotted true}]
                                                               [:spacer 0]
                                                               [:heading.heading-name (t :badge/IssuerInfo ul)]
                                                               [:spacer 0]
                                                               [:paragraph.generic
                                                                [:chunk.chunk (str (t :badge/IssuerDescription ul)": ")] (:issuer_description %) ]
                                                               [:spacer 1]
                                                               [:paragraph.generic
                                                                [:chunk.chunk (str (t :badge/IssuerWebsite ul)": ")]
                                                                [:anchor {:target (:issuer_content_url %) :style{:family :times-roman :color [66 100 162]}}  (:issuer_content_url %)]]
                                                               [:paragraph.generic
                                                                [:chunk.chunk (str (t :badge/IssuerContact ul)": ")] (:issuer_contact %)]
                                                               (when-not (= "-" (:creator_description %))
                                                                 [:paragraph.generic
                                                                  [:chunk.chunk (str (t :badge/CreatorDescription ul)": ")] (:creator_description %)])
                                                               (when-not (= "-" (:creator_url %))
                                                                 [:paragraph.generic
                                                                  [:chunk.chunk (str (t :badge/CreatorWebsite ul)": ")] [:anchor {:target (:creator_url %) :style{:family :times-roman :color [66 100 162]}} (:creator_url %)] "\n"])
                                                               (when-not (= "-" (:creator_email %))
                                                                 [:paragraph.generic
                                                                  [:chunk.chunk (str (t :badge/CreatorContact ul)": ")] (:creator_email %)])
                                                               (let [issuer-endorsement (replace-nils (select-issuer-endorsements {:id (:issuer_content_id %)} (u/get-db ctx)))]
                                                                 (when-not (empty? issuer-endorsement)
                                                                   [:paragraph.generic
                                                                    [:spacer]
