Explorer

definy.localized-texts-update

description
The texts with the English text (if given) and then each of others replaced language by language (definy.localized-texts-set; an empty text removes the language). Used for the descriptions of definy_create_snapshot
type
Fn(
  texts: List<@core.localized-text>,
  english: Union{#none, #some(String)},
  others: List<@core.localized-text>
) -> List<@core.localized-text>
expression
fn(texts$0, english$1, others$2) =>
  @core.list-fold(
    T: @core.localized-text,
    A: List<@core.localized-text>,
    reducer: fn(acc$3, item$4) =>
      @definy.localized-texts-set(texts: $3, language: $4.language, text: $4.text),
    init: $0,
    xs: @core.list-concat(
      left: match $1 {
        #some(text$5) =>
          [{language: "en", text: $5}],
        #none(_) =>
          []
      },
      right: $2
    )
  )
visibility
public
definy.localized-texts-update (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: suLczmeMToa6sNOD4gLk-WzDQk6vaswMj5RqzrffAPM
content hash: 9jMxoX7IHN6Lk1sqRxxSw-g8YNtDrVNgvuOypsGwRsg