Explorer

html-ui.accept-language

description
The first display language of html-ui in an Accept-Language header ('' if none. Ignores q, since browsers send them in order)
type
Fn(header: String) -> String
expression
fn(header$0) =>
  @core.list-fold(
    T: String,
    A: String,
    reducer: fn(acc$1, item$2) =>
      match @core.equal(left: $1, right: "") {
        false =>
          $1,
        true =>
          @html-ui.supported-language(
            code: @core.string-replace(
              text: @html-ui.segment(
                segments: @core.string-split(
                  text: @html-ui.segment(segments: @core.string-split(text: $2, separator: ";"), index: 0),
                  separator: "-"
                ),
                index: 0
              ),
              from: " ",
              to: ""
            )
          )
      },
    init: "",
    xs: @core.string-split(text: $0, separator: ",")
  )
visibility
public
html-ui.accept-language (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: XbwceMymOqaMmHhhozypHDPOizqT_Fey9Wy-cp8I9CA
content hash: NXHXAEjoHGsVT8WttIY0jpZYWOvcV913FWdNilAJFds